<!DOCTYPE html>
<!-- saved from url=(0075)https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA -->
<html lang="en" class=" is-u2f-enabled"><head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# object: http://ogp.me/ns/object# article: http://ogp.me/ns/article# profile: http://ogp.me/ns/profile#"><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    
    

    <link crossorigin="anonymous" href="数值比例尺 · d3_d3 Wiki_files/frameworks-c07e6f4b02b556d1d85052fb3853caf84c80e6b23dcdb1ae1b00f051da1115a2.css" integrity="sha256-wH5vSwK1VtHYUFL7OFPK+EyA5rI9zbGuGwDwUdoRFaI=" media="all" rel="stylesheet">
    <link crossorigin="anonymous" href="数值比例尺 · d3_d3 Wiki_files/github-09e1c38d593bf8fc6e4c4f1b526d0184e27c433d64963942c1e8c361589f8125.css" integrity="sha256-CeHDjVk7+PxuTE8bUm0BhOJ8Qz1kljlCwejDYVifgSU=" media="all" rel="stylesheet">
    
    
    
    

    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="Content-Language" content="en">
    <meta name="viewport" content="width=device-width">
    
    <title>数值比例尺 · d3/d3 Wiki</title>
    <link rel="search" type="application/opensearchdescription+xml" href="https://github.com/opensearch.xml" title="GitHub">
    <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub">
    <link rel="apple-touch-icon" href="https://github.com/apple-touch-icon.png">
    <link rel="apple-touch-icon" sizes="57x57" href="https://github.com/apple-touch-icon-57x57.png">
    <link rel="apple-touch-icon" sizes="60x60" href="https://github.com/apple-touch-icon-60x60.png">
    <link rel="apple-touch-icon" sizes="72x72" href="https://github.com/apple-touch-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="76x76" href="https://github.com/apple-touch-icon-76x76.png">
    <link rel="apple-touch-icon" sizes="114x114" href="https://github.com/apple-touch-icon-114x114.png">
    <link rel="apple-touch-icon" sizes="120x120" href="https://github.com/apple-touch-icon-120x120.png">
    <link rel="apple-touch-icon" sizes="144x144" href="https://github.com/apple-touch-icon-144x144.png">
    <link rel="apple-touch-icon" sizes="152x152" href="https://github.com/apple-touch-icon-152x152.png">
    <link rel="apple-touch-icon" sizes="180x180" href="https://github.com/apple-touch-icon-180x180.png">
    <meta property="fb:app_id" content="1401488693436528">

      <meta content="https://avatars1.githubusercontent.com/u/1562726?v=3&amp;s=400" name="twitter:image:src"><meta content="@github" name="twitter:site"><meta content="summary" name="twitter:card"><meta content="d3/d3" name="twitter:title"><meta content="d3 - Bring data to life with SVG, Canvas and HTML. :bar_chart::chart_with_upwards_trend::tada:" name="twitter:description">
      <meta content="https://avatars1.githubusercontent.com/u/1562726?v=3&amp;s=400" property="og:image"><meta content="GitHub" property="og:site_name"><meta content="object" property="og:type"><meta content="d3/d3" property="og:title"><meta content="https://github.com/d3/d3" property="og:url"><meta content="d3 - Bring data to life with SVG, Canvas and HTML. :bar_chart::chart_with_upwards_trend::tada:" property="og:description">
      <meta name="browser-stats-url" content="https://api.github.com/_private/browser/stats">
    <meta name="browser-errors-url" content="https://api.github.com/_private/browser/errors">
    <link rel="assets" href="https://assets-cdn.github.com/">
    <link rel="web-socket" href="wss://live.github.com/_sockets/VjI6MTQyMzUxMDM1OjBhMmE2NjIxZmVjMDcyY2Y1ODAxOTA1YTUwNjI0YzM0NTIzMDA2OTNkNGE0OGI5ZTZlMjNmMzU5MzA5YzdlODc=--e94a559a8919593844d6aead5746b26e7a3b1f48">
    <meta name="pjax-timeout" content="1000">
    <link rel="sudo-modal" href="https://github.com/sessions/sudo_modal">
    <meta name="request-id" content="E406:7555:114812C:1C66BD2:588453D4" data-pjax-transient="">

    <meta name="msapplication-TileImage" content="/windows-tile.png">
    <meta name="msapplication-TileColor" content="#ffffff">
    <meta name="selected-link" value="repo_wiki" data-pjax-transient="">

    <meta name="google-site-verification" content="KT5gs8h0wvaagLKAVWq8bbeNwnZZK1r1XQysX3xurLU">
<meta name="google-site-verification" content="ZzhVyEFwb7w3e0-uOTltm8Jsck2F5StVihD0exw2fsA">
    <meta name="google-analytics" content="UA-3769691-2">

<style type="text/css"></style><meta content="collector.githubapp.com" name="octolytics-host"><meta content="github" name="octolytics-app-id"><meta content="E406:7555:114812C:1C66BD2:588453D4" name="octolytics-dimension-request_id"><meta content="18323475" name="octolytics-actor-id"><meta content="defenderhhhh" name="octolytics-actor-login"><meta content="70592ef2d225e449076dd88e6b12c145017fd92eccf81e729a16009ced6970cb" name="octolytics-actor-hash">
<meta content="/<user-name>/<repo-name>/wiki/show" data-pjax-transient="true" name="analytics-location">



  <meta class="js-ga-set" name="dimension1" content="Logged In">



        <meta name="hostname" content="github.com">
    <meta name="user-login" content="defenderhhhh">

        <meta name="expected-hostname" content="github.com">
      <meta name="js-proxy-site-detection-payload" content="NTZhMWUzMzQ1MTViOTk1MGM2NTgwM2I0NWM5OGNhOWE2MDgxNjJmYmQwMGNhMDViNGVkYmNiMTRhN2VmZjIwNXx7InJlbW90ZV9hZGRyZXNzIjoiMjIyLjE4MC4xNjAuMTU0IiwicmVxdWVzdF9pZCI6IkU0MDY6NzU1NToxMTQ4MTJDOjFDNjZCRDI6NTg4NDUzRDQiLCJ0aW1lc3RhbXAiOjE0ODUwNjcyMjAsImhvc3QiOiJnaXRodWIuY29tIn0=">


      <link rel="mask-icon" href="https://assets-cdn.github.com/pinned-octocat.svg" color="#000000">
      <link rel="icon" type="image/x-icon" href="https://assets-cdn.github.com/favicon.ico">

    <meta name="html-safe-nonce" content="7da07f67fa3bc09c6326a894464ac00a14a92cab">

    <meta http-equiv="x-pjax-version" content="94a9cc48ead92329faac49833ac14041">
    

      
  <meta name="description" content="d3 - Bring data to life with SVG, Canvas and HTML. :bar_chart::chart_with_upwards_trend::tada:">
  <meta name="go-import" content="github.com/d3/d3 git https://github.com/d3/d3.git">

  <meta content="1562726" name="octolytics-dimension-user_id"><meta content="d3" name="octolytics-dimension-user_login"><meta content="943149" name="octolytics-dimension-repository_id"><meta content="d3/d3" name="octolytics-dimension-repository_nwo"><meta content="true" name="octolytics-dimension-repository_public"><meta content="false" name="octolytics-dimension-repository_is_fork"><meta content="943149" name="octolytics-dimension-repository_network_root_id"><meta content="d3/d3" name="octolytics-dimension-repository_network_root_nwo">
  <link href="https://github.com/d3/d3/commits/master.atom" rel="alternate" title="Recent Commits to d3:master" type="application/atom+xml">


  </head>


  <body class="logged-in  env-production windows vis-public">
    <div id="js-pjax-loader-bar" class="pjax-loader-bar"><div class="progress"></div></div>
    <a href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#start-of-content" tabindex="1" class="accessibility-aid js-skip-to-content">Skip to content</a>

    
    
    



        <div class="header header-logged-in true" role="banner">
  <div class="container clearfix">

    <a class="header-logo-invertocat" href="https://github.com/" data-hotkey="g d" aria-label="Homepage" data-ga-click="Header, go to dashboard, icon:logo">
  <svg aria-hidden="true" class="octicon octicon-mark-github" height="28" version="1.1" viewBox="0 0 16 16" width="28"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path></svg>
</a>


        <div class="header-search scoped-search site-scoped-search js-site-search" role="search">
  <!-- '"` --><!-- </textarea></xmp> --><form accept-charset="UTF-8" action="https://github.com/d3/d3/search" class="js-site-search-form" data-scoped-search-url="/d3/d3/search" data-unscoped-search-url="/search" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"></div>
    <label class="form-control header-search-wrapper js-chromeless-input-container">
      <div class="header-search-scope">This repository</div>
      <input type="text" class="form-control header-search-input js-site-search-focus js-site-search-field is-clearable" data-hotkey="s" name="q" placeholder="Search" aria-label="Search this repository" data-unscoped-placeholder="Search GitHub" data-scoped-placeholder="Search" autocapitalize="off">
    </label>
</form></div>


      <ul class="header-nav float-left" role="navigation">
        <li class="header-nav-item">
          <a href="https://github.com/pulls" aria-label="Pull requests you created" class="js-selected-navigation-item header-nav-link" data-ga-click="Header, click, Nav menu - item:pulls context:user" data-hotkey="g p" data-selected-links="/pulls /pulls/assigned /pulls/mentioned /pulls">
            Pull requests
</a>        </li>
        <li class="header-nav-item">
          <a href="https://github.com/issues" aria-label="Issues you created" class="js-selected-navigation-item header-nav-link" data-ga-click="Header, click, Nav menu - item:issues context:user" data-hotkey="g i" data-selected-links="/issues /issues/assigned /issues/mentioned /issues">
            Issues
</a>        </li>
          <li class="header-nav-item">
            <a class="header-nav-link" href="https://gist.github.com/" data-ga-click="Header, go to gist, text:gist">Gist</a>
          </li>
      </ul>

    
<ul class="header-nav user-nav float-right" id="user-links">
  <li class="header-nav-item">
    

  </li>

  <li class="header-nav-item dropdown js-menu-container">
    <a class="header-nav-link tooltipped tooltipped-s js-menu-target" href="https://github.com/new" aria-label="Create new…" data-ga-click="Header, create new, icon:add">
      <svg aria-hidden="true" class="octicon octicon-plus float-left" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 9H7v5H5V9H0V7h5V2h2v5h5z"></path></svg>
      <span class="dropdown-caret"></span>
    </a>

    <div class="dropdown-menu-content js-menu-content">
      <ul class="dropdown-menu dropdown-menu-sw">
        
<a class="dropdown-item" href="https://github.com/new" data-ga-click="Header, create new repository">
  New repository
</a>

  <a class="dropdown-item" href="https://github.com/new/import" data-ga-click="Header, import a repository">
    Import repository
  </a>

<a class="dropdown-item" href="https://gist.github.com/" data-ga-click="Header, create new gist">
  New gist
</a>

  <a class="dropdown-item" href="https://github.com/organizations/new" data-ga-click="Header, create new organization">
    New organization
  </a>



  <div class="dropdown-divider"></div>
  <div class="dropdown-header">
    <span title="d3/d3">This repository</span>
  </div>
    <a class="dropdown-item" href="https://github.com/d3/d3/issues/new" data-ga-click="Header, create new issue">
      New issue
    </a>

      </ul>
    </div>
  </li>

  <li class="header-nav-item dropdown js-menu-container">
    <a class="header-nav-link name tooltipped tooltipped-sw js-menu-target" href="https://github.com/defenderhhhh" aria-label="View profile and more" data-ga-click="Header, show menu, icon:avatar">
      <img alt="@defenderhhhh" class="avatar" height="20" src="数值比例尺 · d3_d3 Wiki_files/18323475" width="20">
      <span class="dropdown-caret"></span>
    </a>

    <div class="dropdown-menu-content js-menu-content">
      <div class="dropdown-menu dropdown-menu-sw">
        <div class="dropdown-header header-nav-current-user css-truncate">
          Signed in as <strong class="css-truncate-target">defenderhhhh</strong>
        </div>

        <div class="dropdown-divider"></div>

        <a class="dropdown-item" href="https://github.com/defenderhhhh" data-ga-click="Header, go to profile, text:your profile">
          Your profile
        </a>
        <a class="dropdown-item" href="https://github.com/defenderhhhh?tab=stars" data-ga-click="Header, go to starred repos, text:your stars">
          Your stars
        </a>
        <a class="dropdown-item" href="https://github.com/explore" data-ga-click="Header, go to explore, text:explore">
          Explore
        </a>
          <a class="dropdown-item" href="https://github.com/integrations" data-ga-click="Header, go to integrations, text:integrations">
            Integrations
          </a>
        <a class="dropdown-item" href="https://help.github.com/" data-ga-click="Header, go to help, text:help">
          Help
        </a>

        <div class="dropdown-divider"></div>

        <a class="dropdown-item" href="https://github.com/settings/profile" data-ga-click="Header, go to settings, icon:settings">
          Settings
        </a>

        <!-- '"` --><!-- </textarea></xmp> --><form accept-charset="UTF-8" action="https://github.com/logout" class="logout-form" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"><input name="authenticity_token" type="hidden" value="/ZakPzmazDIYnaq6yyWZiPvNHj5/Flrcqe97Koowt50XBNns45UY1al5z5T1wC473sS/Hy/YycdlxefoWmPJAg=="></div>
          <button type="submit" class="dropdown-item dropdown-signout" data-ga-click="Header, sign out, icon:logout">
            Sign out
          </button>
</form>      </div>
    </div>
  </li>
</ul>


    
  </div>
</div>


      


    <div id="start-of-content" class="accessibility-aid"></div>

      <div id="js-flash-container">
</div>


    <div role="main">
        <div itemscope="" itemtype="http://schema.org/SoftwareSourceCode">
    <div id="js-repo-pjax-container" data-pjax-container="">
      
<div class="pagehead repohead instapaper_ignore readability-menu experiment-repo-nav">
  <div class="container repohead-details-container">

    

<ul class="pagehead-actions">

  <li>
        <!-- '"` --><!-- </textarea></xmp> --><form accept-charset="UTF-8" action="https://github.com/notifications/subscribe" class="js-social-container" data-autosubmit="true" data-remote="true" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"><input name="authenticity_token" type="hidden" value="RpIPRi3ViUhOUdy6uTU2RLY1nZf1+3mVsEUzgc+xLif0AmxNykAPzNT85AbHGx+khHg+En4C+vrgTcQIhng7dg=="></div>      <input class="form-control" id="repository_id" name="repository_id" type="hidden" value="943149">

        <div class="select-menu js-menu-container js-select-menu">
          <a href="https://github.com/d3/d3/subscription" class="btn btn-sm btn-with-count select-menu-button js-menu-target" role="button" tabindex="0" aria-haspopup="true" data-ga-click="Repository, click Watch settings, action:wiki#show">
            <span class="js-select-button">
              <svg aria-hidden="true" class="octicon octicon-eye" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8.06 2C3 2 0 8 0 8s3 6 8.06 6C13 14 16 8 16 8s-3-6-7.94-6zM8 12c-2.2 0-4-1.78-4-4 0-2.2 1.8-4 4-4 2.22 0 4 1.8 4 4 0 2.22-1.78 4-4 4zm2-4c0 1.11-.89 2-2 2-1.11 0-2-.89-2-2 0-1.11.89-2 2-2 1.11 0 2 .89 2 2z"></path></svg>
              Watch
            </span>
          </a>
          <a class="social-count js-social-count" href="https://github.com/d3/d3/watchers" aria-label="2939 users are watching this repository">
            2,939
          </a>

        <div class="select-menu-modal-holder">
          <div class="select-menu-modal subscription-menu-modal js-menu-content" aria-hidden="true">
            <div class="select-menu-header js-navigation-enable" tabindex="-1">
              <svg aria-label="Close" class="octicon octicon-x js-menu-close" height="16" role="img" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"></path></svg>
              <span class="select-menu-title">Notifications</span>
            </div>

              <div class="select-menu-list js-navigation-container" role="menu">

                <div class="select-menu-item js-navigation-item selected" role="menuitem" tabindex="0">
                  <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"></path></svg>
                  <div class="select-menu-item-text">
                    <input checked="checked" id="do_included" name="do" type="radio" value="included">
                    <span class="select-menu-item-heading">Not watching</span>
                    <span class="description">Be notified when participating or @mentioned.</span>
                    <span class="js-select-button-text hidden-select-button-text">
                      <svg aria-hidden="true" class="octicon octicon-eye" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8.06 2C3 2 0 8 0 8s3 6 8.06 6C13 14 16 8 16 8s-3-6-7.94-6zM8 12c-2.2 0-4-1.78-4-4 0-2.2 1.8-4 4-4 2.22 0 4 1.8 4 4 0 2.22-1.78 4-4 4zm2-4c0 1.11-.89 2-2 2-1.11 0-2-.89-2-2 0-1.11.89-2 2-2 1.11 0 2 .89 2 2z"></path></svg>
                      Watch
                    </span>
                  </div>
                </div>

                <div class="select-menu-item js-navigation-item " role="menuitem" tabindex="0">
                  <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"></path></svg>
                  <div class="select-menu-item-text">
                    <input id="do_subscribed" name="do" type="radio" value="subscribed">
                    <span class="select-menu-item-heading">Watching</span>
                    <span class="description">Be notified of all conversations.</span>
                    <span class="js-select-button-text hidden-select-button-text">
                      <svg aria-hidden="true" class="octicon octicon-eye" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8.06 2C3 2 0 8 0 8s3 6 8.06 6C13 14 16 8 16 8s-3-6-7.94-6zM8 12c-2.2 0-4-1.78-4-4 0-2.2 1.8-4 4-4 2.22 0 4 1.8 4 4 0 2.22-1.78 4-4 4zm2-4c0 1.11-.89 2-2 2-1.11 0-2-.89-2-2 0-1.11.89-2 2-2 1.11 0 2 .89 2 2z"></path></svg>
                      Unwatch
                    </span>
                  </div>
                </div>

                <div class="select-menu-item js-navigation-item " role="menuitem" tabindex="0">
                  <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"></path></svg>
                  <div class="select-menu-item-text">
                    <input id="do_ignore" name="do" type="radio" value="ignore">
                    <span class="select-menu-item-heading">Ignoring</span>
                    <span class="description">Never be notified.</span>
                    <span class="js-select-button-text hidden-select-button-text">
                      <svg aria-hidden="true" class="octicon octicon-mute" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8 2.81v10.38c0 .67-.81 1-1.28.53L3 10H1c-.55 0-1-.45-1-1V7c0-.55.45-1 1-1h2l3.72-3.72C7.19 1.81 8 2.14 8 2.81zm7.53 3.22l-1.06-1.06-1.97 1.97-1.97-1.97-1.06 1.06L11.44 8 9.47 9.97l1.06 1.06 1.97-1.97 1.97 1.97 1.06-1.06L13.56 8l1.97-1.97z"></path></svg>
                      Stop ignoring
                    </span>
                  </div>
                </div>

              </div>

            </div>
          </div>
        </div>
</form>
  </li>

  <li>
      <div class="js-toggler-container js-social-container starring-container ">
    <!-- '"` --><!-- </textarea></xmp> --><form accept-charset="UTF-8" action="https://github.com/d3/d3/unstar" class="starred" data-remote="true" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"><input name="authenticity_token" type="hidden" value="JeRi/gq1fyPxceN+oH+UfPV1twR2JHk2Mq2R2nW/x/aSp8FJLlhAg9gmLhZB6egUJVa3Bkk0rtI8/XwD8F/RHA=="></div>
      <button type="submit" class="btn btn-sm btn-with-count js-toggler-target" aria-label="Unstar this repository" title="Unstar d3/d3" data-ga-click="Repository, click unstar button, action:wiki#show; text:Unstar">
        <svg aria-hidden="true" class="octicon octicon-star" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M14 6l-4.9-.64L7 1 4.9 5.36 0 6l3.6 3.26L2.67 14 7 11.67 11.33 14l-.93-4.74z"></path></svg>
        Unstar
      </button>
        <a class="social-count js-social-count" href="https://github.com/d3/d3/stargazers" aria-label="59436 users starred this repository">
          59,436
        </a>
</form>
    <!-- '"` --><!-- </textarea></xmp> --><form accept-charset="UTF-8" action="https://github.com/d3/d3/star" class="unstarred" data-remote="true" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"><input name="authenticity_token" type="hidden" value="EVSjp8noXSHJ6UR66mSrs9Hv8onJAACecG76FSpCMDnEQuYgcgWvbw1O7qO7YN6eZ5q64vHG3FWZ5e3wxXOs9Q=="></div>
      <button type="submit" class="btn btn-sm btn-with-count js-toggler-target" aria-label="Star this repository" title="Star d3/d3" data-ga-click="Repository, click star button, action:wiki#show; text:Star">
        <svg aria-hidden="true" class="octicon octicon-star" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M14 6l-4.9-.64L7 1 4.9 5.36 0 6l3.6 3.26L2.67 14 7 11.67 11.33 14l-.93-4.74z"></path></svg>
        Star
      </button>
        <a class="social-count js-social-count" href="https://github.com/d3/d3/stargazers" aria-label="59436 users starred this repository">
          59,436
        </a>
</form>  </div>

  </li>

  <li>
          <!-- '"` --><!-- </textarea></xmp> --><form accept-charset="UTF-8" action="https://github.com/d3/d3/fork" class="btn-with-count" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"><input name="authenticity_token" type="hidden" value="N2vzo4ApOZ1nt/j9Nvvx3/MoMOQWC3NDh9Lj8VTHDWfREV0PwADb6CdQAFJ3vFDkzHO8tefEaa+hiL+BVMOgow=="></div>
            <button type="submit" class="btn btn-sm btn-with-count" data-ga-click="Repository, show fork modal, action:wiki#show; text:Fork" title="Fork your own copy of d3/d3 to your account" aria-label="Fork your own copy of d3/d3 to your account">
              <svg aria-hidden="true" class="octicon octicon-repo-forked" height="16" version="1.1" viewBox="0 0 10 16" width="10"><path fill-rule="evenodd" d="M8 1a1.993 1.993 0 0 0-1 3.72V6L5 8 3 6V4.72A1.993 1.993 0 0 0 2 1a1.993 1.993 0 0 0-1 3.72V6.5l3 3v1.78A1.993 1.993 0 0 0 5 15a1.993 1.993 0 0 0 1-3.72V9.5l3-3V4.72A1.993 1.993 0 0 0 8 1zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3 10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3-10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"></path></svg>
              Fork
            </button>
</form>
    <a href="https://github.com/d3/d3/network" class="social-count" aria-label="15846 users forked this repository">
      15,846
    </a>
  </li>
</ul>

    <h1 class="public ">
  <svg aria-hidden="true" class="octicon octicon-repo" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M4 9H3V8h1v1zm0-3H3v1h1V6zm0-2H3v1h1V4zm0-2H3v1h1V2zm8-1v12c0 .55-.45 1-1 1H6v2l-1.5-1.5L3 16v-2H1c-.55 0-1-.45-1-1V1c0-.55.45-1 1-1h10c.55 0 1 .45 1 1zm-1 10H1v2h2v-1h3v1h5v-2zm0-10H2v9h9V1z"></path></svg>
  <span class="author" itemprop="author"><a href="https://github.com/d3" class="url fn" rel="author">d3</a></span><!--
--><span class="path-divider">/</span><!--
--><strong itemprop="name"><a href="https://github.com/d3/d3" data-pjax="#js-repo-pjax-container">d3</a></strong>

</h1>

  </div>
  <div class="container">
    
<nav class="reponav js-repo-nav js-sidenav-container-pjax" itemscope="" itemtype="http://schema.org/BreadcrumbList" role="navigation" data-pjax="#js-repo-pjax-container">

  <span itemscope="" itemtype="http://schema.org/ListItem" itemprop="itemListElement">
    <a href="https://github.com/d3/d3" class="js-selected-navigation-item reponav-item" data-hotkey="g c" data-selected-links="repo_source repo_downloads repo_commits repo_releases repo_tags repo_branches /d3/d3" itemprop="url">
      <svg aria-hidden="true" class="octicon octicon-code" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M9.5 3L8 4.5 11.5 8 8 11.5 9.5 13 14 8 9.5 3zm-5 0L0 8l4.5 5L6 11.5 2.5 8 6 4.5 4.5 3z"></path></svg>
      <span itemprop="name">Code</span>
      <meta itemprop="position" content="1">
</a>  </span>

    <span itemscope="" itemtype="http://schema.org/ListItem" itemprop="itemListElement">
      <a href="https://github.com/d3/d3/issues" class="js-selected-navigation-item reponav-item" data-hotkey="g i" data-selected-links="repo_issues repo_labels repo_milestones /d3/d3/issues" itemprop="url">
        <svg aria-hidden="true" class="octicon octicon-issue-opened" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg>
        <span itemprop="name">Issues</span>
        <span class="counter">0</span>
        <meta itemprop="position" content="2">
</a>    </span>

  <span itemscope="" itemtype="http://schema.org/ListItem" itemprop="itemListElement">
    <a href="https://github.com/d3/d3/pulls" class="js-selected-navigation-item reponav-item" data-hotkey="g p" data-selected-links="repo_pulls /d3/d3/pulls" itemprop="url">
      <svg aria-hidden="true" class="octicon octicon-git-pull-request" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M11 11.28V5c-.03-.78-.34-1.47-.94-2.06C9.46 2.35 8.78 2.03 8 2H7V0L4 3l3 3V4h1c.27.02.48.11.69.31.21.2.3.42.31.69v6.28A1.993 1.993 0 0 0 10 15a1.993 1.993 0 0 0 1-3.72zm-1 2.92c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zM4 3c0-1.11-.89-2-2-2a1.993 1.993 0 0 0-1 3.72v6.56A1.993 1.993 0 0 0 2 15a1.993 1.993 0 0 0 1-3.72V4.72c.59-.34 1-.98 1-1.72zm-.8 10c0 .66-.55 1.2-1.2 1.2-.65 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"></path></svg>
      <span itemprop="name">Pull requests</span>
      <span class="counter">0</span>
      <meta itemprop="position" content="3">
</a>  </span>

  <a href="https://github.com/d3/d3/projects" class="js-selected-navigation-item reponav-item" data-selected-links="repo_projects new_repo_project repo_project /d3/d3/projects">
    <svg aria-hidden="true" class="octicon octicon-project" height="16" version="1.1" viewBox="0 0 15 16" width="15"><path fill-rule="evenodd" d="M10 12h3V2h-3v10zm-4-2h3V2H6v8zm-4 4h3V2H2v12zm-1 1h13V1H1v14zM14 0H1a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h13a1 1 0 0 0 1-1V1a1 1 0 0 0-1-1z"></path></svg>
    Projects
    <span class="counter">0</span>
</a>
    <a href="https://github.com/d3/d3/wiki" class="js-selected-navigation-item selected reponav-item" data-hotkey="g w" data-selected-links="repo_wiki /d3/d3/wiki">
      <svg aria-hidden="true" class="octicon octicon-book" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M3 5h4v1H3V5zm0 3h4V7H3v1zm0 2h4V9H3v1zm11-5h-4v1h4V5zm0 2h-4v1h4V7zm0 2h-4v1h4V9zm2-6v9c0 .55-.45 1-1 1H9.5l-1 1-1-1H2c-.55 0-1-.45-1-1V3c0-.55.45-1 1-1h5.5l1 1 1-1H15c.55 0 1 .45 1 1zm-8 .5L7.5 3H2v9h6V3.5zm7-.5H9.5l-.5.5V12h6V3z"></path></svg>
      Wiki
</a>

  <a href="https://github.com/d3/d3/pulse" class="js-selected-navigation-item reponav-item" data-selected-links="pulse /d3/d3/pulse">
    <svg aria-hidden="true" class="octicon octicon-pulse" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M11.5 8L8.8 5.4 6.6 8.5 5.5 1.6 2.38 8H0v2h3.6l.9-1.8.9 5.4L9 8.5l1.6 1.5H14V8z"></path></svg>
    Pulse
</a>
  <a href="https://github.com/d3/d3/graphs" class="js-selected-navigation-item reponav-item" data-selected-links="repo_graphs repo_contributors /d3/d3/graphs">
    <svg aria-hidden="true" class="octicon octicon-graph" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M16 14v1H0V0h1v14h15zM5 13H3V8h2v5zm4 0H7V3h2v10zm4 0h-2V6h2v7z"></path></svg>
    Graphs
</a>

</nav>

  </div>
</div>

<div class="container new-discussion-timeline experiment-repo-nav">
  <div class="repository-content">

    

<div id="wiki-wrapper" class="wiki-wrapper page">
<div class="gh-header">
  <div class="gh-header-show">
        <div class="gh-header-actions">
          <a href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA/_edit" class="btn btn-sm ">Edit</a>
          <a href="https://github.com/d3/d3/wiki/_new" class="btn btn-sm btn-primary">New Page</a>
        </div>
    <h1 class="gh-header-title instapaper_title">数值比例尺</h1>
      <div class="gh-header-meta">
        tianxuzhang edited this page <relative-time datetime="2016-04-06T13:15:18Z" title="2016年4月6日 GMT+8下午9:15">on 6 Apr 2016</relative-time>
        ·
        <a href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA/_history" class="history">
          7 revisions
        </a>
      </div>
  </div>
</div>
<div id="wiki-content" class="wiki-content">
  <div class="has-rightbar">

  <div id="wiki-rightbar" class="wiki-rightbar">
    <div class="wiki-pages-box readability-sidebar boxed-group flush js-wiki-pages-box " role="navigation">
      
<h3 class="js-wiki-toggle-collapse wiki-auxiliary-content">
  <svg aria-hidden="true" class="octicon octicon-triangle-down caret-expanded" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M0 5l6 6 6-6z"></path></svg>
  <svg aria-hidden="true" class="octicon octicon-triangle-right caret-collapsed" height="16" version="1.1" viewBox="0 0 6 16" width="6"><path fill-rule="evenodd" d="M0 14l6-6-6-6z"></path></svg>
  Pages <span class="counter">116</span>
</h3>
<div class="boxed-group-inner wiki-auxiliary-content wiki-auxiliary-content-no-bg">
    <div class="filter-bar">
      <input type="text" id="wiki-pages-filter" class="form-control input-sm input-block js-filterable-field" placeholder="Find a Page…" aria-label="Find a Page…" tabindex="2">
    </div>

  <ul class="wiki-pages" data-filterable-for="wiki-pages-filter" data-filterable-type="substring">
    <li>
      <strong><a href="https://github.com/d3/d3/wiki" class="wiki-page-link">Home</a></strong>
    </li>
    <li>
      <strong><a href="https://github.com/d3/d3/wiki/3.0" class="wiki-page-link">3.0</a></strong>
    </li>
    <li>
      <strong><a href="https://github.com/d3/d3/wiki/3.1" class="wiki-page-link">3.1</a></strong>
    </li>
    <li>
      <strong><a href="https://github.com/d3/d3/wiki/API--%E4%B8%AD%E6%96%87%E6%89%8B%E5%86%8C" class="wiki-page-link">API  中文手册</a></strong>
    </li>
    <li>
      <strong><a href="https://github.com/d3/d3/wiki/API-Reference" class="wiki-page-link">API Reference</a></strong>
    </li>
    <li>
      <strong><a href="https://github.com/d3/d3/wiki/API-Reference-(%D1%80%D1%83%D1%81%D1%81%D0%BA%D0%BE%D1%8F%D0%B7%D1%8B%D1%87%D0%BD%D0%B0%D1%8F-%D0%B2%D0%B5%D1%80%D1%81%D0%B8%D1%8F)" class="wiki-page-link">API Reference (русскоязычная версия)</a></strong>
    </li>
    <li>
      <strong><a href="https://github.com/d3/d3/wiki/API-%E3%83%AA%E3%83%95%E3%82%A1%E3%83%AC%E3%83%B3%E3%82%B9" class="wiki-page-link">API リファレンス</a></strong>
    </li>
    <li>
      <strong><a href="https://github.com/d3/d3/wiki/Arrays" class="wiki-page-link">Arrays</a></strong>
    </li>
    <li>
      <strong><a href="https://github.com/d3/d3/wiki/Behaviors" class="wiki-page-link">Behaviors</a></strong>
    </li>
    <li>
      <strong><a href="https://github.com/d3/d3/wiki/Bundle-Layout" class="wiki-page-link">Bundle Layout</a></strong>
    </li>
    <li>
      <strong><a href="https://github.com/d3/d3/wiki/Chord-Layout" class="wiki-page-link">Chord Layout</a></strong>
    </li>
    <li>
      <strong><a href="https://github.com/d3/d3/wiki/Cluster-Layout" class="wiki-page-link">Cluster Layout</a></strong>
    </li>
    <li>
      <strong><a href="https://github.com/d3/d3/wiki/CN-Home" class="wiki-page-link">CN Home</a></strong>
    </li>
    <li>
      <strong><a href="https://github.com/d3/d3/wiki/Colors" class="wiki-page-link">Colors</a></strong>
    </li>
    <li>
      <strong><a href="https://github.com/d3/d3/wiki/Core" class="wiki-page-link">Core</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/CSV" class="wiki-page-link">CSV</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/CSV%E6%A0%BC%E5%BC%8F%E5%8C%96" class="wiki-page-link">CSV格式化</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Drag-Behavior" class="wiki-page-link">Drag Behavior</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Force-Layout" class="wiki-page-link">Force Layout</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Formatting" class="wiki-page-link">Formatting</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Gallery" class="wiki-page-link">Gallery</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Geo" class="wiki-page-link">Geo</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Geo-Paths" class="wiki-page-link">Geo Paths</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Geo-Projections" class="wiki-page-link">Geo Projections</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Geo-Streams" class="wiki-page-link">Geo Streams</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Geometry" class="wiki-page-link">Geometry</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Hierarchy-Layout" class="wiki-page-link">Hierarchy Layout</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Histogram-Layout" class="wiki-page-link">Histogram Layout</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Hull-Geom" class="wiki-page-link">Hull Geom</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/ID-Home" class="wiki-page-link">ID Home</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Internals" class="wiki-page-link">Internals</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/JP-3.0" class="wiki-page-link">JP 3.0</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/JP-API-Reference" class="wiki-page-link">JP API Reference</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/JP-Home" class="wiki-page-link">JP Home</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/JP-Tutorials" class="wiki-page-link">JP Tutorials</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Layouts" class="wiki-page-link">Layouts</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Learning-paths" class="wiki-page-link">Learning paths</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Localization" class="wiki-page-link">Localization</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Math" class="wiki-page-link">Math</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Namespaces" class="wiki-page-link">Namespaces</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Ordinal-Scales" class="wiki-page-link">Ordinal Scales</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Pack-Layout" class="wiki-page-link">Pack Layout</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Partition-Layout" class="wiki-page-link">Partition Layout</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Pie-Layout" class="wiki-page-link">Pie Layout</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Plugins" class="wiki-page-link">Plugins</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Polygon-Geom" class="wiki-page-link">Polygon Geom</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Quadtree-Geom" class="wiki-page-link">Quadtree Geom</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Quantitative-Scales" class="wiki-page-link">Quantitative Scales</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Release-Notes" class="wiki-page-link">Release Notes</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Requests" class="wiki-page-link">Requests</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Scales" class="wiki-page-link">Scales</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Selection-(russians)" class="wiki-page-link">Selection (russians)</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Selections" class="wiki-page-link">Selections</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Stack-Layout" class="wiki-page-link">Stack Layout</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/SVG" class="wiki-page-link">SVG</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/SVG-Axes" class="wiki-page-link">SVG Axes</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/SVG-Controls" class="wiki-page-link">SVG Controls</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/SVG-Events" class="wiki-page-link">SVG Events</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/SVG-Shapes" class="wiki-page-link">SVG Shapes</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/SVG-%E5%BD%A2%E7%8A%B6" class="wiki-page-link">SVG 形状</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/SVG-%E6%8E%A7%E4%BB%B6" class="wiki-page-link">SVG 控件</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/SVG-%E8%BD%B4" class="wiki-page-link">SVG 轴</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/SVG%E5%87%BD%E6%95%B0" class="wiki-page-link">SVG函数</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Time" class="wiki-page-link">Time</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Time-Formatting" class="wiki-page-link">Time Formatting</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Time-Intervals" class="wiki-page-link">Time Intervals</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Time-Scales" class="wiki-page-link">Time Scales</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Transitions" class="wiki-page-link">Transitions</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Tree-Layout" class="wiki-page-link">Tree Layout</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Treemap-Layout" class="wiki-page-link">Treemap Layout</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Tutorials" class="wiki-page-link">Tutorials</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/TW-Home" class="wiki-page-link">TW Home</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Upgrading-to-3.0" class="wiki-page-link">Upgrading to 3.0</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Voronoi-Geom" class="wiki-page-link">Voronoi Geom</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Zoom-Behavior" class="wiki-page-link">Zoom Behavior</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%D0%92%D1%8B%D0%B1%D0%BE%D1%80%D0%BA%D0%B8" class="wiki-page-link">Выборки</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E5%86%85%E9%83%A8" class="wiki-page-link">内部</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E5%87%A0%E4%BD%95" class="wiki-page-link">几何</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E5%88%86%E5%8C%BA%E5%B8%83%E5%B1%80" class="wiki-page-link">分区布局</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E5%8A%9B%E5%B8%83%E5%B1%80" class="wiki-page-link">力布局</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E5%8C%85%E5%B8%83%E5%B1%80" class="wiki-page-link">包布局</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4" class="wiki-page-link">命名空间</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E5%9B%9B%E5%8F%89%E6%A0%91" class="wiki-page-link">四叉树</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E5%9C%B0%E7%90%86" class="wiki-page-link">地理</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E5%9C%B0%E7%90%86%E6%8A%95%E5%BD%B1" class="wiki-page-link">地理投影</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E5%9C%B0%E7%90%86%E8%B7%AF%E5%BE%84" class="wiki-page-link">地理路径</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E5%A0%86%E5%8F%A0%E5%B8%83%E5%B1%80" class="wiki-page-link">堆叠布局</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E5%A4%9A%E8%BE%B9%E5%BD%A2" class="wiki-page-link">多边形</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E5%B1%82%E6%AC%A1%E5%B8%83%E5%B1%80" class="wiki-page-link">层次布局</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E5%B8%83%E5%B1%80" class="wiki-page-link">布局</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E5%BA%8F%E6%95%B0%E6%AF%94%E4%BE%8B%E5%B0%BA" class="wiki-page-link">序数比例尺</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E5%BC%A6%E5%B8%83%E5%B1%80" class="wiki-page-link">弦布局</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E6%8B%96%E5%8A%A8" class="wiki-page-link">拖动</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E6%8D%86%E5%B8%83%E5%B1%80" class="wiki-page-link">捆布局</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E6%8D%86%E7%BB%91%E5%B8%83%E5%B1%80" class="wiki-page-link">捆绑布局</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="数值比例尺 · d3_d3 Wiki_files/数值比例尺 · d3_d3 Wiki.html" class="wiki-page-link">数值比例尺</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%AD%A6" class="wiki-page-link">数学</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84" class="wiki-page-link">数组</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E6%97%B6%E9%97%B4%E6%AF%94%E4%BE%8B%E5%B0%BA" class="wiki-page-link">时间比例尺</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E6%9C%AC%E5%9C%B0%E5%8C%96" class="wiki-page-link">本地化</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E6%A0%91%E5%B8%83%E5%B1%80" class="wiki-page-link">树布局</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E6%A0%B8%E5%BF%83%E5%87%BD%E6%95%B0" class="wiki-page-link">核心函数</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E6%A0%BC%E5%BC%8F%E5%8C%96" class="wiki-page-link">格式化</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E6%AF%94%E4%BE%8B%E5%B0%BA" class="wiki-page-link">比例尺</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E6%B3%B0%E6%A3%AE%E5%A4%9A%E8%BE%B9%E5%BD%A2" class="wiki-page-link">泰森多边形</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E7%9B%B4%E6%96%B9%E5%9B%BE%E5%B8%83%E5%B1%80" class="wiki-page-link">直方图布局</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E7%9F%A9%E5%BD%A2%E6%A0%91%E5%B8%83%E5%B1%80" class="wiki-page-link">矩形树布局</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E7%B0%87%E5%B8%83%E5%B1%80" class="wiki-page-link">簇布局</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E7%BC%A9%E6%94%BE" class="wiki-page-link">缩放</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E8%A1%8C%E4%B8%BA" class="wiki-page-link">行为</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E8%AF%B7%E6%B1%82" class="wiki-page-link">请求</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E8%B5%AB%E5%B0%94" class="wiki-page-link">赫尔</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E8%BF%87%E6%B8%A1" class="wiki-page-link">过渡</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E9%80%89%E6%8B%A9%E5%99%A8" class="wiki-page-link">选择器</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E9%A2%9C%E8%89%B2" class="wiki-page-link">颜色</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E9%A5%BC%E5%B8%83%E5%B1%80" class="wiki-page-link">饼布局</a></strong>
    </li>
    <li class="wiki-more-pages-link">
      <a href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#" class="js-wiki-more-pages-link">
        Show 101 more pages…
      </a>
    </li>
  </ul>
</div>

    </div>


    <div class="clone-url">
      <h5>Clone this wiki locally</h5>
      <div class="input-group js-zeroclipboard-container">
        <input type="text" class="form-control input-sm text-small text-gray input-monospace js-url-field js-zeroclipboard-target" aria-label="Clone URL for this wiki" value="https://github.com/d3/d3.wiki.git" readonly="readonly">
        <span class="input-group-button">
          <button aria-label="Copy to clipboard" class="js-zeroclipboard btn btn-sm zeroclipboard-button tooltipped tooltipped-s" data-copied-hint="Copied!" type="button"><svg aria-hidden="true" class="octicon octicon-clippy" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M2 13h4v1H2v-1zm5-6H2v1h5V7zm2 3V8l-3 3 3 3v-2h5v-2H9zM4.5 9H2v1h2.5V9zM2 12h2.5v-1H2v1zm9 1h1v2c-.02.28-.11.52-.3.7-.19.18-.42.28-.7.3H1c-.55 0-1-.45-1-1V4c0-.55.45-1 1-1h3c0-1.11.89-2 2-2 1.11 0 2 .89 2 2h3c.55 0 1 .45 1 1v5h-1V6H1v9h10v-2zM2 5h8c0-.55-.45-1-1-1H8c-.55 0-1-.45-1-1s-.45-1-1-1-1 .45-1 1-.45 1-1 1H3c-.55 0-1 .45-1 1z"></path></svg></button>
        </span>
      </div>


        <a href="https://windows.github.com/" class="btn btn-sm sidebar-button" title="Save this wiki to your computer and use it in GitHub Desktop." aria-label="Save this wiki to your computer and use it in GitHub Desktop.">
          <svg aria-hidden="true" class="octicon octicon-desktop-download" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 6h3V0h2v6h3l-4 4-4-4zm11-4h-4v1h4v8H1V3h4V2H1c-.55 0-1 .45-1 1v9c0 .55.45 1 1 1h5.34c-.25.61-.86 1.39-2.34 2h8c-1.48-.61-2.09-1.39-2.34-2H15c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1z"></path></svg>
          Clone in Desktop
        </a>
    </div>
  </div>

  <div id="wiki-body" class="wiki-body gollum-markdown-content instapaper_body">
      <div class="markdown-body">
        <blockquote>
<p><a href="https://github.com/d3/d3/wiki/Home">Wiki</a> ▸ <a class="internal present" href="https://github.com/d3/d3/wiki/API--%E4%B8%AD%E6%96%87%E6%89%8B%E5%86%8C">API--中文手册</a> ▸ <a class="internal present" href="https://github.com/d3/d3/wiki/%E6%AF%94%E4%BE%8B%E5%B0%BA">比例尺</a> ▸ <strong>数值比例尺</strong></p>
</blockquote>

<ul>
<li>本文档是D3官方文档中文翻译，并保持与<a href="https://github.com/mbostock/d3/wiki/API-Reference">最新版</a>同步。</li>
<li>如发现翻译不当或有其他问题可以通过以下方式联系译者:</li>
<li>邮箱：<a href="mailto:zhang_tianxu@sina.com">zhang_tianxu@sina.com</a>
</li>
<li>QQ群：<a href="http://jq.qq.com/?_wv=1027&amp;k=239rjew">D3.js</a>:437278817，<a href="http://jq.qq.com/?_wv=1027&amp;k=S8wGMe">大数据可视化</a>：436442115</li>
<li>Github小组：<a href="https://github.com/VisualCrew">VisualCrew</a>：<a href="https://github.com/VisualCrew">https://github.com/VisualCrew</a>
</li>
</ul>

<p><strong>比例尺</strong> 是将定义域映射为值域的函数 <strong>数值比例尺</strong> 有连续的定义域，例如一系列数字或时间。序数比例尺有离散的定义域，例如一组名称或类别。比例尺在D3中是个可选功能。使用比例尺可以极大地简化从数据纬度到可视化展示的映射。</p>

<p>比例尺对象（例如，由<a href="https://github.com/d3/d3/wiki/Quantitative-Scales#linear">d3.scale.linear</a>返回的对象）的返回值既是一个对象也是一个函数。像D3 中的其他类，比例尺遵循链式语法：setter 方法直接返回比例尺自身，允许在一个简洁的语句中调用多个setter 方法。</p>

<h2>
<a id="user-content-线性比例尺" class="anchor" href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#%E7%BA%BF%E6%80%A7%E6%AF%94%E4%BE%8B%E5%B0%BA" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>线性比例尺</h2>

<p>线性比例尺是最常见的比例尺，为连续地把输入域映射到连续的输出范围提供了良好的缺省选择。该映射是线性的，输出范围值<em>y</em>可以表示为输入域值<em>x</em>的线性函数为：<em>y</em> = <em>mx</em> + <em>b</em>。输入域通常是要可视化的数据维度，如学生在样本群的身高(米为单位)。输出范围通常是所需输出的可视化维度，如直方图的中条的高度(以像素为单位)。</p>

<p>状态维数 (state dimensions) 为 <a href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#linear_domain">domain</a>, <a href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#linear_range">range</a>, <a href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#linear_interpolate">output interpolator</a> 和 <a href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#linear_clamp">clamping behavior</a>.</p>

<p><a name="user-content-linear" href="https://github.com/d3/d3/wiki/Quantitative-Scales#linear">#</a> d3.scale.<b>linear</b>()</p>

<p>用默认域[0,1]构造一个新的比例尺，默认的范围为[0,1]。因此，默认比例尺相当于数字恒等函数；例如linear(0.5)返回0.5。</p>

<p><a name="user-content-_linear" href="https://github.com/d3/d3/wiki/Quantitative-Scales#_linear">#</a> <b>linear</b>(<i>x</i>)</p>

<p>在输入域中的输入<em>x</em>，返回输出范围对应的值。 </p>

<p>注意：某些插值器(<a href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#linear_interpolate">interpolators</a>)会<strong>重用返回值</strong>。例如，如果域值是任意的对象，然后 <a href="https://github.com/d3/d3/wiki/Transitions#d3_interpolateObject">d3.interpolateObject</a> 自动执行，比例尺重用返回的对象。通常情况下，一个比例尺的返回值被立即用于设置属性(<a href="https://github.com/d3/d3/wiki/Selections#attr">attribute</a>)或样式(<a href="https://github.com/d3/d3/wiki/Selections#style">style</a>)，你不必担心这一点；但是，如果你需要存储比例尺的返回值，使用字符串强制转换或酌情创建一个副本。</p>

<p><a name="user-content-linear_invert" href="https://github.com/d3/d3/wiki/Quantitative-Scales#linear_invert">#</a> linear.<b>invert</b>(<i>y</i>)</p>

<p>返回值的输入域<em>X</em>在输出范围<em>y</em>中的相应值。这代表了逆映射的范围域。在输出范围的有效值y ，linear(linear.invert(<em>y</em>))等于<em>y</em> ;类似地，在输入域中的有效数值<em>x</em>时 ，linear.invert(linear(<em>x</em>))等于<em>x</em>。等价地，你可以通过建立一个新的比例尺，交换定义域和值域进行反转操作。翻转操作在交互中特别有用的，例如，以确定在对应于该像素位置的鼠标下的输入域的值。</p>

<p>注：如果输出范围是数字只能用倒置操作来支持！ D3允许的输出范围是任何类型的;引擎盖下， <a href="https://github.com/d3/d3/wiki/%E8%BF%87%E6%B8%A1#d3_interpolate">d3.interpolate</a>或您选择的自定义插值是用来归一化参数<em>t</em>映射到输出范围内的值。因此，输出范围可以是颜色，字符串，或者甚至任意对象。由于没有设施，以"uninterpolate"来标注任意类型，倒置操作目前仅在数值范围的支持。</p>

<p><a name="user-content-linear_domain" href="https://github.com/d3/d3/wiki/Quantitative-Scales#linear_domain">#</a> linear.<b>domain</b>([<i>numbers</i>])</p>

<p>如果数字<em>numbers</em>被指定，设置比例尺的输入域到数字的指定数组。数组必须包含两个或两个以上的数字。如果给定的数组中的元素不是数字，他们将被强制转换为数字;这种强迫发生同样，当规模被调用。因此，线性标尺可用于类型，如日期的对象(<a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date" title="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date">date objects</a>)可以被转换成数字编码;但是，它通常是用<a href="https://github.com/d3/d3/wiki/%E6%97%B6%E9%97%B4%E6%AF%94%E4%BE%8B%E5%B0%BA">d3.time.scale</a>的日期更方便。 (您可以使用的<a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/valueOf" title="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/valueOf">valueOf</a>实现自己的转换数量的对象。)如果未指定数字，则返回比例尺的输入域。</p>

<p>虽然线性标度通常只有两个数值在其域中，可以用polylinear比例尺指定两个以上的值。在这种情况下，必须有值的输出范围内的当量数。一个polylinear刻度表示多个分段线性尺度上划分一个连续的定义域和值域。这是用于定义发散的定量尺度是特别有用的。例如，把白色和红色作为负值，白色和绿色作为正值：</p>

<div class="highlight highlight-source-js"><pre><span class="pl-k">var</span> color <span class="pl-k">=</span> <span class="pl-smi">d3</span>.<span class="pl-smi">scale</span>.<span class="pl-en">linear</span>()
    .<span class="pl-en">domain</span>([<span class="pl-k">-</span><span class="pl-c1">1</span>, <span class="pl-c1">0</span>, <span class="pl-c1">1</span>])
    .<span class="pl-en">range</span>([<span class="pl-s"><span class="pl-pds">"</span>red<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>white<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>green<span class="pl-pds">"</span></span>]);</pre></div>

<p>所得到的值的颜色( - 0.5)是RGB(255，128，128)和色彩(0.5)的值是RGB(128，192，128)。在内部，polylinear比例尺通过二分查找对应于给定域值输出插值。通过重复在这两个领域和范围值，你也可以强制输入域的块映射到一个固定的输出范围。</p>

<p><a name="user-content-linear_range" href="https://github.com/d3/d3/wiki/Quantitative-Scales#linear_range">#</a> linear.<b>range</b>([<i>values</i>])</p>

<p>如果值被指定，设置刻度的输出范围值的指定数组。数组必须包含两个或多个值，以匹配输入域的基数，否则第二个的长被截断以匹配另一个。给定的数组中的元素不必是数字;所支持的底层的内插器(<a href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#linear_interpolate">interpolator</a>)的任何值都可以。然而，数值范围是必需的倒置运算符。如果未指定<em>values</em>的值，则返回当前比例次的输出范围。</p>

<p><a name="user-content-linear_rangeRound" href="https://github.com/d3/d3/wiki/Quantitative-Scales#linear_rangeRound">#</a> linear.<b>rangeRound</b>(<i>values</i>)</p>

<p>用指定数组设置比例尺的范围值，而比例尺的插补器也设置为<a href="https://github.com/d3/d3/wiki/%E8%BF%87%E6%B8%A1#d3_interpolateRound">d3.interpolateRound</a>。这是用于当输出由刻度值应该是准确的整数，例如，以避免抗混叠伪像一个方便例程。另外，也可以在比例被施加之后手动四舍五入。</p>

<p><a name="user-content-linear_interpolate" href="https://github.com/d3/d3/wiki/Quantitative-Scales#linear_interpolate">#</a> linear.<b>interpolate</b>([<i>factory</i>])</p>

<p>如果指定了工厂<em>factory</em>，设置使用指定的工厂规模的输出插值。内插器工厂默认为<a href="https://github.com/d3/d3/wiki/%E8%BF%87%E6%B8%A1#d3_interpolate">d3.interpolate</a>，并用于在[0,1]范围内的归一化域参数t在输出范围对应的值。内插器工厂将用于从输出范围构造内插器为每一对相邻的值。如果未指定工厂，返回规模的插补工厂。</p>

<p><a name="user-content-linear_clamp" href="https://github.com/d3/d3/wiki/Quantitative-Scales#linear_clamp">#</a> linear.<b>clamp</b>([<i>boolean</i>])</p>

<p>如果布尔变量<em>boolean</em>被指定，用于启用或禁用相应地夹集。默认情况下，夹集被禁用，例如，如果输入域之外的值传递给规模，规模可能外面的输出范围，通过线性外推法返回一个值。例如，使用缺省域并[0,1]范围内，与2的输入值将返回2的输出值，如果夹集被启用，归一化的域参数<em>t</em>被钳位到范围[0,1]这样规模的返回值总是规模的输出范围之内。如果未指定布尔值，则返回的规模当前夹值输出范围之内。</p>

<p><a name="user-content-linear_nice" href="https://github.com/d3/d3/wiki/Quantitative-Scales#linear_nice">#</a> linear.<b>nice</b>([<i>count</i>])</p>

<p>它开始和结束圆标记值的扩展域。这种方法通常会修改规模域，并且只能在边界延伸到最近的整数值。根据下列公式计算圆值的精度依赖于域dx的程度：exp(round(log(<em>dx</em>)) - 1)。如果该域是从数据计算并可以是不规则，则nice是有用的。例如，对于[0.20147987687960267, 0.996679553296417]一个领域，漂亮的论域为[0.2, 1]。如果域有两个以上的值，nice这个域只影响第一个和最后一个值。</p>

<p>可选的计数参数<em>count</em>允许更大的控制权用于扩展边界的步长，保证返回的<a href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#linear_ticks">ticks</a>可完全覆盖域。</p>

<p><a name="user-content-linear_ticks" href="https://github.com/d3/d3/wiki/Quantitative-Scales#linear_ticks">#</a> linear.<b>ticks</b>([<i>count</i>])</p>

<p>从比例尺上的输入域的代表值返回约数。如果未指定<em>count</em>，则默认为10。返回的刻度值是均匀间隔的，具有人类可读的值(如10的幂的倍数)，并且保证是输入域的范围之内。刻度尺通常用于显示参考线或刻度线，在与可视化数据一起使用。指定的计数<em>count</em>是只是一个提示;规模可能取决于输入域返回更多或更少的值。</p>

<p><a name="user-content-linear_tickFormat" href="https://github.com/d3/d3/wiki/Quantitative-Scales#linear_tickFormat">#</a> linear.<b>tickFormat</b>(<i>count</i>, [<i>format</i>])</p>

<p>返回格式化的数字<a href="https://github.com/d3/d3/wiki/%E6%A0%BC%E5%BC%8F%E5%8C%96#d3_format">number format</a>用于显示刻度值的值。指定的计数应具有相同的值被用于产生刻度的计数。您不必使用刻度尺的内置刻度格式，但它会自动计算的基础上刻度值之间的固定间隔适当的精度。</p>

<p>可选的格式参数<em>format</em>允许指定的格式说明符<a href="https://github.com/d3/d3/wiki/%E6%A0%BC%E5%BC%8F%E5%8C%96#d3_format">format specifier</a>，其中格式的精度自动被取代的规模是适当的刻度间隔。例如，要格式化百分比变化，你可能会说：</p>

<div class="highlight highlight-source-js"><pre><span class="pl-k">var</span> x <span class="pl-k">=</span> <span class="pl-smi">d3</span>.<span class="pl-smi">scale</span>.<span class="pl-en">linear</span>().<span class="pl-en">domain</span>([<span class="pl-k">-</span><span class="pl-c1">1</span>, <span class="pl-c1">1</span>]);
<span class="pl-en">console</span>.<span class="pl-c1">log</span>(<span class="pl-smi">x</span>.<span class="pl-en">ticks</span>(<span class="pl-c1">5</span>).<span class="pl-en">map</span>(<span class="pl-smi">x</span>.<span class="pl-en">tickFormat</span>(<span class="pl-c1">5</span>, <span class="pl-s"><span class="pl-pds">"</span>+%<span class="pl-pds">"</span></span>))); <span class="pl-c"><span class="pl-c">//</span> ["-100%", "-50%", "+0%", "+50%", "+100%"]</span></pre></div>

<p>如果格式已经指定了精度，这种方法相当于d3.format。</p>

<p>同样地，如果<em>format</em>使用了格式类型<code>s</code>，比例尺将基于定义域中的最大值计算SI-前缀，使用SI-前缀的案例：<a href="http://bl.ocks.org/mbostock/9764126">all tick values</a>。如果<em>format</em>已经指定了精度，则等价于<a href="https://github.com/d3/d3/wiki/Formatting#d3_format">d3.format</a>。</p>

<p>注意：当结合数轴使用对数比例尺时，通常要用<a href="https://github.com/d3/d3/wiki/SVG-Axes#ticks">axis.ticks</a>而不是<a href="https://github.com/d3/d3/wiki/SVG-Axes#tickFormat">axis.tickFormat</a>，案例：<a href="http://bl.ocks.org/mbostock/5537697">bl.ocks.org/5537697</a>.</p>

<p><a name="user-content-linear_copy" href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#linear_copy">#</a> linear.<b>copy</b>()
返回该线性标尺的精确副本。改变这一比例尺不会影响返回的比例尺，反之亦然。</p>

<h3>
<a id="user-content-恒等比例尺" class="anchor" href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#%E6%81%92%E7%AD%89%E6%AF%94%E4%BE%8B%E5%B0%BA" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>恒等比例尺</h3>

<p>恒等尺是线性尺的一个特例其定义域和值域相同；尺以及它的反转方法都是恒等的。与像素坐标工作时，这些尺度偶尔有用，例如在与轴<a href="https://github.com/d3/d3/wiki/SVG-%E8%BD%B4">axis</a>和刷<a href="https://github.com/d3/d3/wiki/SVG-%E6%8E%A7%E4%BB%B6#brush">brush</a>组件一起使用。</p>

<p><a name="user-content-identity" href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#identity">#</a> d3.scale.<b>identity</b>()</p>

<p>构造一个新恒等尺，默认定义域[0，1]，默认值域是[0，1]。恒等尺总是等同于恒等函数。</p>

<p><a name="user-content-_identity" href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#_identity">#</a> <b>identity</b>(<i>x</i>)<br>
<a href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#_identity">#</a> identity.<b>invert</b>(<i>x</i>)</p>

<p>返回给定值<em>x</em>。</p>

<p><a name="user-content-identity_domain" href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#identity_domain">#</a> identity.<b>domain</b>([<i>numbers</i>])<br>
<a href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#identity_domain">#</a> identity.<b>range</b>([<i>numbers</i>])</p>

<p>如果指定了数字<em>numbers</em>，设置尺度的输入域和输出范围为指定的数字数组。这个数组必须包含两个或两个以上的数字。如果给定的数组中的元素不是数字，他们将被强制转换为数字; 这种强制转换在尺scale被调用时同样发生。 如果未指定数字，则返回尺的当前输入定义域(或等价地，输出范围)。</p>

<p><a name="user-content-identity_ticks" href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#identity_ticks">#</a> identity.<b>ticks</b>([<i>count</i>])</p>

<p>大致返回刻度的输入域(或等价地，输出范围)<em>count</em> 代表性的值。如果未指定<em>count</em>，则默认为10。返回的刻度值是均匀间隔的，具有人类可读的值(如10的幂的倍数)，并且保证是输入域的范围之内。刻度线通常用于显示在与可视化数据一起使用的参考线或刻度线。指定的计数<em>count</em>是只是一个提示;刻度取决于输入域可能返回更多或更少的值。</p>

<p><a name="user-content-identity_tickFormat" href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#identity_tickFormat">#</a> identity.<b>tickFormat</b>(<i>count</i>, [<i>format</i>])</p>

<p>返回适合用于显示刻度值的数字格式<a href="https://github.com/d3/d3/wiki/%E6%A0%BC%E5%BC%8F%E5%8C%96#d3_format">number format</a>函数。指定的计数<em>count</em> 应和用于产生刻度值的计数的值相等。您不必使用尺度的内置刻度格式，但它会基于刻度值之间的固定间隔自动计算适当的精度。</p>

<p>可选参数<em>format</em>允许指定格式说明符<a href="https://github.com/d3/d3/wiki/%E6%A0%BC%E5%BC%8F%E5%8C%96#d3_format%5D%5D">format specifier</a>。如果格式说明符没有一个定义的精度，精度将由尺自动设置，并返回相应的格式。这提供了方便，可用声明的方式指定一个格式其精度将由尺度自动设置。</p>

<p><a name="user-content-identity_copy" href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#identity_copy">#</a> identity.<b>copy</b>()</p>

<p>返回此尺度的精确副本。改变这一尺度不会影响返回的尺度，反之亦然。</p>

<h2>
<a id="user-content-乘方比例尺" class="anchor" href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#%E4%B9%98%E6%96%B9%E6%AF%94%E4%BE%8B%E5%B0%BA" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>乘方比例尺</h2>

<p>除了有一个在输出范围值被计算之前应用于输入值域的指数变换之外，乘方比例尺类似于线性比例尺。映射到输出范围值<em>y</em>可以被表示为一个输入值域<em>x</em>的函数：<em>y</em> = <em>mx^k</em> + <em>b</em>,其中<em>k</em>是指数的值。乘方比例尺也支持负值，在这种情况下，输入值权力天平也支持负值,在这种情况下,输入值以指数-1进行乘方计算,由此产生的输出值也将以-1来乘方计算。</p>

<p><a name="user-content-sqrt" href="https://github.com/d3/d3/wiki/Quantitative-Scales#sqrt">#</a> d3.scale.<b>sqrt</b>()</p>

<p>构造一个新的乘方比例尺，输入值域默认为[0,1],输出范围默认为[0,1],指数默认为0.5。这种方法可以简记为:</p>

<div class="highlight highlight-source-js"><pre><span class="pl-smi">d3</span>.<span class="pl-smi">scale</span>.<span class="pl-en">pow</span>().<span class="pl-en">exponent</span>(<span class="pl-c1">.5</span>)</pre></div>

<p>返回的比例尺是一个函数,它接受一个代表输入值域中某一个值的参数x,返回值是对应于输出范围的一个值。因此,这个比例尺对于数字来说，相当于函数<a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Math/sqrt" title="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Math/sqrt">sqrt</a>的功能；例如:sqrt(0.25)的结果将返回0.5。</p>

<p><a name="user-content-pow" href="https://github.com/d3/d3/wiki/Quantitative-Scales#pow">#</a> d3.scale.<b>pow</b>()</p>

<p>构造一个新的乘方比例尺，默认输入值域为[0,1],默认输出范围[0,1],默认指数为1。因此,对于数字来说，默认的乘方比例尺相当于数字正比例函数(the identity function);例如pow(0.5)的结果将返回0.5。</p>

<p><a name="user-content-_pow" href="https://github.com/d3/d3/wiki/Quantitative-Scales#_pow">#</a> <b>pow</b>(<i>x</i>)</p>

<p>给定一个输入域值<em>x</em>,返回输出范围中相应的值。</p>

<p>注意:一些<a href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#pow_interpolate">interpolators</a><em>重用返回值</em>。例如,如果值域是任意对象,然后<a href="https://github.com/d3/d3/wiki/Transitions#d3_interpolateObject">d3.interpolateObject</a>自动被应用并且比例尺重用这个返回的对象。通常,一个比例尺的返回值会立刻被应用于设置一个属性(<a href="https://github.com/d3/d3/wiki/%E9%80%89%E6%8B%A9%E5%99%A8#attr">attribute</a>)或样式(<a href="https://github.com/d3/d3/wiki/%E9%80%89%E6%8B%A9%E5%99%A8#style">style</a>),你不必担心；不过,如果你需要存储比例尺的返回值,可以适当地使用字符串强转换或复制值。</p>

<p><a name="user-content-pow_invert" href="https://github.com/d3/d3/wiki/Quantitative-Scales#pow_invert">#</a> pow.<b>invert</b>(<i>y</i>)</p>

<p>返回对应于输出域值<em>y</em>值的输入值域值<em>x</em>。这意味着从输出范围到输入值域映射关系的逆向操作。对于一个有效的输出范围值<em>y</em>，<code>pow(pow.invert(y))</code>的结果等于<em>y</em>，对于一个有效的输入域值<em>x</em>，<code>pow.invert(pow(x))</code>的结果等于<em>x</em>。同样，你可以通过交换输出与输入值域的新比例尺的建立去创建其逆操作。对于确定输入值域的值(此值对应于鼠标下的像素位置)而言，这个逆操作对于交互尤为重要。</p>

<p>注意:逆操作仅仅支持输出范围是数字的情况！D3是允许输出范围属于任意类型；在其内部结构中，<a href="https://github.com/d3/d3/wiki/%E8%BF%87%E6%B8%A1#d3_interpolate">d3.interpolate</a>或者一个自定义的插值器是用来映射这个标准化参数<em>t</em>到一个输出范围的值。因此，输出范围可能是颜色值、字符串、甚至任意的对象。</p>

<p><a name="user-content-pow_domain" href="https://github.com/d3/d3/wiki/Quantitative-Scales#pow_domain">#</a> pow.<b>domain</b>([<i>numbers</i>])</p>

<p>如果参数<em>numbers</em>被指定，便将指定的数组设置为比例尺的输入值域。这个数组必须包含2个或更多的数据值。如果给定的数组中的元素不是数字，它们便被强转为数字；当比例尺被调用时强转同样会发生。因此，一个乘方比例尺被用来编码可以被转换为数字的任意类型。如果<em>numbers</em>没有被指定，将返回比例尺当前的输入值域。</p>

<p>与线性比例尺(详见<a href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#linear_domain">linear.domain</a>)一样,对于输入和输出值域乘方比例尺也可以接受超过两个以上的值,因而产生结果的polypower比例尺。</p>

<p><a name="user-content-pow_range" href="https://github.com/d3/d3/wiki/Quantitative-Scales#pow_range">#</a> pow.<b>range</b>([<i>values</i>])</p>

<p>如果<em>values</em>被指定,便将指定包含<em>values</em>的数组设置为比例尺的输出范围。这个数组必须包含两个或两个以上的值,来对应匹配输入域的基数,否则多于两个以上的将被截断从而去对应其它值。给定数组中的元素不要求必须为数字;支持基本插值器(<a href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#pow_interpolate">interpolator</a>)的任何值都可以使用。然而,数字范围需要转化操作符去转化。如果<em>values</em>没有被指定,将返回当前的输出范围。</p>

<p><a name="user-content-pow_rangeRound" href="https://github.com/d3/d3/wiki/Quantitative-Scales#pow_rangeRound">#</a> pow.<b>rangeRound</b>(<i>values</i>)</p>

<p>将指定的values组成的数组设置为输出范围，同时设置比例尺的插值器到<a href="https://github.com/d3/d3/wiki/%E8%BF%87%E6%B8%A1#d3_interpolateRound">d3.interpolateRound</a>。当比例尺输出的值需要为整数时，这便是一个非常方便使用套路，以此避免不确定性的小数产生。也可以在比例尺应用后通过手动将输出值处理为整数。</p>

<p><a name="user-content-pow_exponent" href="https://github.com/d3/d3/wiki/Quantitative-Scales#pow_exponent">#</a> pow.<b>exponent</b>([<i>k</i>])</p>

<p>如果k值被指定值,当前指数将被设置为<em>k</em>值。如果<em>k</em>值没有被指定,则返回当前指数。默认值是1。</p>

<p><a name="user-content-pow_interpolate" href="https://github.com/d3/d3/wiki/Quantitative-Scales#pow_interpolate">#</a> pow.<b>interpolate</b>([<i>factory</i>])</p>

<p>如果工厂<em>factory</em>被指定,便将此指定的工厂<em>factory</em>设置为比例尺的输出插值器。插值器工厂默认用<a href="https://github.com/d3/d3/wiki/%E8%BF%87%E6%B8%A1#d3_interpolate">d3.interpolate</a>,并且它被用来将标准的[0,1]的值域参数t映射到相关的输出值域中对应的值。这个插值器工厂将针对输出值域中每两个相邻的值来用于构建插值器。如果没有指定工厂<em>factory</em>,将返回比例尺的插入器工厂。</p>

<p><a name="user-content-pow_clamp" href="https://github.com/d3/d3/wiki/Quantitative-Scales#pow_clamp">#</a> pow.<b>clamp</b>([<i>boolean</i>])</p>

<p>如果布尔值<em>boolean</em>被指定,启用或禁用相应的闭合。默认情况下,是启用闭合,这样的情况下,如果一个超出输入值域的值在传递给比例尺时，比例尺将通过线性外推法返回一个输出范围外的一个值。例如,使用输入和输出值域采用默认值域[0,1],那么对于输入值为2的就会返回一个输出值2。如果启用了闭合,标准的值域参数<em>t</em>将被闭合在值域区间[0,1]中，这样的情况下，比例尺的返回值总是在比例尺的输出范围内。如果布尔值<em>boolean</em>不被指定,返回值都将在输出范围内(returns whether or not the scale currently clamps values to within the output range)。</p>

<p><a name="user-content-pow_nice" href="https://github.com/d3/d3/wiki/Quantitative-Scales#pow_nice">#</a> pow.<b>nice</b>([<i>m</i>])</p>

<p>扩展值域,即它的开始和结束值都处理为容易识别的整数值。这种方法通常来修改比例尺的值域,可能只是将临界的值处理为最近的整数值。这个整数值的精度依赖于值域<em>dx</em>的范围，根据下列的公式：exp(round(log(<em>dx</em>)) - 1)。如果值域是通过不规则的值计算而来的，那么这样处理(使用本函数)是很有用的。例如,对于一个值域为[0.20147987687960267,0.996679553296417],那么好的值域(可以通过本函数处理)便是(0.2,1)。如果值域拥有超过两个的值,那么这样处理后只能影响到第一个和最后一个值。</p>

<p>可选参数<em>m</em>允许指定一个滴答计数用来被指定用来在扩展边界值之前去控制步长使用。  </p>

<p><a name="user-content-pow_ticks" href="https://github.com/d3/d3/wiki/Quantitative-Scales#pow_ticks">#</a> pow.<b>ticks</b>([<i>count</i>])</p>

<p>近似地返回个数<em>count</em>来自于比例尺输入值域的代表数。如果<em>count</em>没有被指定,默认为10。返回的值都有均匀一致的间隔,拥有人类可读的值(如乘方指数为10的倍数),并保证是在输入值域的范围内。刻度值(Ticks)通常用于结合可视化数据去显示参考线,或刻度线。指定的<em>count</em>只是一个暗示；比例尺可能会返回值或多或少，这取决于输入值域。</p>

<p><a name="user-content-pow_tickFormat" href="https://github.com/d3/d3/wiki/Quantitative-Scales#pow_tickFormat">#</a> pow.<b>tickFormat</b>([<i>count</i>, [<i>format</i>]])</p>

<p>返回一个数字格式化(number format)函数，适用于显示一个点值。被指定的count数量值与被用来生刻度值的数量相同。你不必使用比例尺的内置的刻度值格式化,但它能够基于固定时间间隔值去自动计算出适当的精度。
可选参数format允许为被指定的格式说明符(format specifier)。如果格式说明符没有明确定义的精度,那么精度将通过比例尺被自动设置，返回适当的格式。这提供了一个便捷的、声明的方式去指定一个格式，此格式的精度将通过比例尺被自动设定。</p>

<p><a name="user-content-pow_copy" href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#pow_copy">#</a> pow.<b>copy</b>()</p>

<p>返回一个比例尺的精确复制体。这个比例尺的变化不会影响到返回的复制体比例尺,反之亦然。</p>

<h2>
<a id="user-content-对数比例尺" class="anchor" href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#%E5%AF%B9%E6%95%B0%E6%AF%94%E4%BE%8B%E5%B0%BA" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>对数比例尺</h2>

<p>对数比例尺类似于线性比例尺，除了有一个对数变换被应用于在输出范围值计算的输入值域的值。映射到输出范围的<em>y</em>值可以表示为一个输入值域<em>x</em>的函数: <em>y</em> = <em>m</em>log(<em>x</em>) + <em>b</em>。 </p>

<p>log(0)是负无穷大，一个对数比例尺必须有一个专门的正域或负域；这个范围不能包含或过零。一个正域对数比例尺有一个定义明确的正值的行为状态，一个负域对数比例尺有一个定义明确的负值的行为状态(输入值乘以-1，所得到的输出值也乘以-1)。如果你传递一个负值给对数比例尺是正域，反之比例尺的行为是未定义的。</p>

<p><a name="user-content-log" href="https://github.com/d3/d3/wiki/Quantitative-Scales#log">#</a> d3.scale.<b>log</b>()</p>

<p>构建一个默认域[1,10]新的对数比例尺，默认范围[0,1]，底数是10。</p>

<p><a name="user-content-_log" href="https://github.com/d3/d3/wiki/Quantitative-Scales#_log">#</a> <b>log</b>(<i>x</i>)</p>

<p>给一个在输入定义域中的x值，返回一个输出值域的相应值。</p>

<p>注：一些内插器(<a href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#log_interpolate">interpolators</a>)<strong>重用返回值</strong>。例如，如果域的值是任意对象，那么<a href="https://github.com/d3/d3/wiki/%E8%BF%87%E6%B8%A1#d3_interpolateObject">d3.interpolateObject</a>是自动应用和按比例返回的对象。通常情况下，一个比例尺的返回值被立即用于设置属性(<a href="https://github.com/d3/d3/wiki/%E9%80%89%E6%8B%A9%E5%99%A8#attr">attribute</a>)或样式(<a href="https://github.com/d3/d3/wiki/%E9%80%89%E6%8B%A9%E5%99%A8#style">style</a>)，你不必担心这一点;但是，如果你需要存储比列尺的返回值，使用字符串控制或创建一个合适的副本。</p>

<p><a name="user-content-log_invert" href="https://github.com/d3/d3/wiki/Quantitative-Scales#log_invert">#</a> log.<b>invert</b>(<i>y</i>)</p>

<p>返回值的输入值域<em>X</em>在输出范围<em>y</em>中的相应值。这代表了逆映射的范围域。在输出范围有效的<em>y</em>值，log(log.invert(<em>y</em>))等于<em>y</em>;同样，在输入值域中的有效值<em>x</em>，log.invert(log(<em>x</em>)) 等于<em>x</em>。相同地，你可以通过建立一个新的比例尺，对变换输入值域和输出范围进行反转操作。反转操作是交互特别有用的，例如，以确定在对应于该像素位置的鼠标下的输入值域的值。</p>

<p>注：反转操作仅支持输出范围是数字！ D3允许的输出范围是任何类型;在后台，<a href="https://github.com/d3/d3/wiki/%E8%BF%87%E6%B8%A1#d3_interpolate">d3.interpolate</a>或您选择的自定义插值是用来归一化参数<em>t</em>映射到输出范围内的值。因此，输出范围可以是颜色，字符串，或者甚至任意对象。由于没有便利以“篡改”任意类型，反转操作目前仅在数值范围的支持。</p>

<p><a name="user-content-log_domain" href="https://github.com/d3/d3/wiki/Quantitative-Scales#log_domain">#</a> log.<b>domain</b>([<i>numbers</i>])</p>

<p>如果指定了数字<em>numbers</em>，设置比例尺的输入值域给数字的指定数组。数组必须包含两个或两个以上的数字。如果给定数组中的元素不是数字，他们将被强制转换为数字;这种强制同样发生在当比例尺被调用。因此，一个对数比例尺可用于能被转换成数字的任何类型。如果数字未指定，则返回比例的当前输入值域。</p>

<p>如线性比例尺(见<a href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#linear_domain">linear.domain</a>)，对数比例尺也可以接受两个以上值的值域和范围，从而得到聚对数函数。</p>

<p><a name="user-content-log_range" href="https://github.com/d3/d3/wiki/Quantitative-Scales#log_range">#</a> log.<b>range</b>([<i>values</i>])</p>

<p>如果值<em>values</em>是指定的，要通过指定数组的值设置比例尺的输出范围。数组必须包含两个或多个值，以匹配输入值域的底数，否则两个中长的会被截断以匹配另一个。给定的数组中的元素不必是数字;所支持的底层的内插器(<a href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#log_interpolate">interpolator</a>)的任何值都可以。然而，数值范围是必需的倒置运算符。如果未指定<em>values</em>值，则返回比例尺的当前输出范围。</p>

<p><a name="user-content-log_rangeRound" href="https://github.com/d3/d3/wiki/Quantitative-Scales#log_rangeRound">#</a> log.<b>rangeRound</b>(<i>values</i>)</p>

<p>设置比例尺的输出范围要通过指定数组的值，而比例尺的内插器也设置为<a href="https://github.com/d3/d3/wiki/%E8%BF%87%E6%B8%A1#d3_interpolateRound">d3.interpolateRound</a>。这是用于输出的比例尺的值应该是准确的整数，以避免抗混叠伪像的一个方便例程。另外，当输出值的比例尺被应用之后也可以手动设置四舍五入求值。</p>

<p><a name="user-content-log_base" href="https://github.com/d3/d3/wiki/Quantitative-Scales#log_base">#</a> log.<b>base</b>([<i>base</i>])</p>

<p>如果指定了底数<em>base</em>，设置这个对数比例尺的底数。如果未指定底数，返回当前的底数，默认为10。</p>

<p><a name="user-content-log_interpolate" href="https://github.com/d3/d3/wiki/Quantitative-Scales#log_interpolate">#</a> log.<b>interpolate</b>([<i>factory</i>])</p>

<p>如果工厂模式<em>factory</em>是指定的，设置比例尺的输出内插器使用指定的工厂模式，内插器的工厂模式默认为<a href="https://github.com/d3/d3/wiki/%E8%BF%87%E6%B8%A1#d3_interpolate">d3.interpolate</a>，并用于在[0,1]的归一化域参数<em>t</em>映射到输出范围对应的值。内插器工厂模式将用于从输出范围创建内插器为每一对相邻的值，如果没有指定的工厂模式时，返回比例尺的内插器的工厂模式。</p>

<p><a name="user-content-log_clamp" href="https://github.com/d3/d3/wiki/Quantitative-Scales#log_clamp">#</a> log.<b>clamp</b>([<i>boolean</i>])</p>

<p>如果布尔值<em>boolean</em>是指定的，启用或禁用相应的锁定。默认情况下，锁定被禁用，例如，如果输入值域之外的值传递给比例尺，比例尺可能返回外面的输出范围，通过线性外推法返回一个值。例如，使用默认值域并在[0,1]范围内，一个2的输入值将返回2的输出值，如果锁定被启用，归一化的域参数<em>t</em>被锁定到范围[0,1]，这样比例尺的返回值始终在比例尺的输出范围之内。如果未指定布尔值，则返回比例尺当前锁定值是否在输出范围内。</p>

<p><a name="user-content-log_nice" href="https://github.com/d3/d3/wiki/Quantitative-Scales#log_nice">#</a> log.<b>nice</b>()</p>

<p>扩展值域以便它开始和结束美化四舍五入的值。这种方法通常会修改比例尺的值域，并可能只有边界延伸至最近的四舍五入的值。最近的整数值是基于比例尺的底数(<a href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#log_base">base</a>)的整数幂，默认为10。美化是有用的，如果该值域是从数据计算的并可以是不规则的。例如，对于值域[0.20147987687960267，0.996679553296417]，美化的值域为[0.1，1]。如果值域有两个以上的值，美化值域只影响第一个和最后一个值。</p>

<p><a name="user-content-log_ticks" href="https://github.com/d3/d3/wiki/Quantitative-Scales#log_ticks">#</a> log.<b>ticks</b>()</p>

<p>从比例尺上的输入值域将返回代表值。返回的刻度值是均匀间隔在10的每个幂的范围内，并保证是输入值域的范围之内。刻度通常用于显示参考线或刻度线，与可视化数据一起使用。请注意，刻度的数量不能自定义(由于对数比例尺的性质);但是，如果你想减少刻度的数量，你可以筛选返回的数组中的值。</p>

<p><a name="user-content-log_tickFormat" href="https://github.com/d3/d3/wiki/Quantitative-Scales#log_tickFormat">#</a> log.<b>tickFormat</b>([<i>count</i>, [<i>format</i>]])</p>

<p>返回一个数字格式(<a href="https://github.com/d3/d3/wiki/%E6%A0%BC%E5%BC%8F%E5%8C%96#d3_format">number format</a>)的函数适合用于显示一个刻度值。这个返回刻度格式是为实现<code>d.toPrecision(1)</code>。如果一个计数<em>count</em>被指定，那么一些刻度标记可能无法显示; 如果没有足够的空间来容纳所有的刻度标记，这是非常有用的。但是，请注意刻度线仍然会显示出来(这样对数比例尺失真仍然可见)。当指定一个计数，你也可能会覆盖这个格式函数<em>format</em>; 您也可以指定一个格式说明符的字符串，它会自动被包裹在<a href="https://github.com/d3/d3/wiki/%E6%A0%BC%E5%BC%8F%E5%8C%96">d3.format</a>。例如，要获得一个刻度格式，将显示20个刻度的货币：</p>

<div class="highlight highlight-source-js"><pre><span class="pl-smi">scale</span>.<span class="pl-en">tickFormat</span>(<span class="pl-c1">20</span>, <span class="pl-s"><span class="pl-pds">"</span>$,.2f<span class="pl-pds">"</span></span>);</pre></div>

<p>如果格式说明符没有一个定义的精度，精度将通过比例尺自动设置，返回适当的格式。这提供了一个便利，既指定其精度格式的声明方式将由比例尺自动设定。</p>

<p><a name="user-content-log_copy" href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#log_copy">#</a> log.<b>copy</b>()</p>

<p>返回此比例尺的精确副本。改变这一比例尺不会影响返回的比例尺，反之亦然。</p>

<h2>
<a id="user-content-量化比例尺" class="anchor" href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#%E9%87%8F%E5%8C%96%E6%AF%94%E4%BE%8B%E5%B0%BA" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>量化比例尺</h2>

<p>量化比例尺是线性比例尺的变体，定义域是连续的，值域是离散的。定义域基于值域的份数将被划分为同样的份数。这种线性关系可以表示为： <em>y</em> = <em>mx</em> + <em>b</em>。定义域是用来可视化的数据维度，例如，人口样本中的一组学生的高度（以米为单位）.值域是输出的可视化维度，例如条形图中的条高（以像素为单位）。</p>

<p><a name="user-content-quantize" href="https://github.com/d3/d3/wiki/Quantitative-Scales#quantize">#</a> d3.scale.<b>quantize</b>()</p>

<p>使用默认的定义域[0,1]，定义一个量化变换，默认的范围是[0,1]；因此，默认的量化变换等同于数值的四舍五入<a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Math/round" title="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Math/round">round</a>方法；例如：quantize(0.49)返回0，quantize(0.51)返回1，详见下例：</p>

<div class="highlight highlight-source-js"><pre><span class="pl-k">var</span> q <span class="pl-k">=</span> <span class="pl-smi">d3</span>.<span class="pl-smi">scale</span>.<span class="pl-en">quantize</span>().<span class="pl-en">domain</span>([<span class="pl-c1">0</span>, <span class="pl-c1">1</span>]).<span class="pl-en">range</span>([<span class="pl-s"><span class="pl-pds">'</span>a<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>b<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>c<span class="pl-pds">'</span></span>]);
<span class="pl-c"><span class="pl-c">//</span>q(0.3) === 'a', q(0.4) === 'b', q(0.6) === 'b', q(0.7) ==='c';</span>
<span class="pl-c"><span class="pl-c">//</span>q.invertExtent('a') returns [0, 0.3333333333333333]</span></pre></div>

<p><a name="user-content-_quantize" href="https://github.com/d3/d3/wiki/Quantitative-Scales#_quantize">#</a> <b>quantize</b>(<i>x</i>)</p>

<p>指定一个值<em>x</em>作为输入域值，返回对应该域值的范围值。
理解：quantize(0.4)则会使用默认的值域0和1，即：该quantize(0.4)返回值为0，因为四舍五入0.4为0，以此类推。</p>

<p><a name="user-content-quantize_invertExtent" href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#quantize_invertExtent">#</a> quantize.<b>invertExtent</b>(<i>y</i>)</p>

<p>根据输出的范围值y返回对应于定义域中的取值范围，即为数组[<em>x0</em>, <em>x1</em>]，该功能即：反向找到值<em>y</em>对应的定义域；这是非常有用的，例如：为了确定对应于该像素的鼠标的可取输入域；</p>

<p><a name="user-content-quantize_domain" href="https://github.com/d3/d3/wiki/Quantitative-Scales#quantize_domain">#</a> quantize.<b>domain</b>([<i>numbers</i>])</p>

<p>如果<em>numbers</em>指定，则设置变换的定义域/输入域为<em>numbers</em>，该numbers是两个元素的数组，即代表定义域的开始和结束；如果该数组的元素多于2个数值，则只会取第一个元素为开始，最后一个元素为结束；如果该数组中元素不是数值，则会强制转换为数值；强制转换会在调用该scale 转换时发生；因此，定量变换可被用于任何可强转成数值的编码/参数类型；如果numbers未指定，则返回当前的定义域/输入域；</p>

<p><a name="user-content-quantize_range" href="https://github.com/d3/d3/wiki/Quantitative-Scales#quantize_range">#</a> quantize.<b>range</b>([<i>values</i>])</p>

<p>如果<em>values</em> 指定，则设置变换的值域/输出域为<em>values</em> ，该<em>values</em> 可以是任何类型的数组元素，并且元素的数量不限；如果values 未指定，则返回当前的值域/输出域。</p>

<p><a name="user-content-quantize_copy" href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#quantize_copy">#</a> quantize.<b>copy</b>()</p>

<p>返回当前变换的一个副本，无论是改变原本或副本，都不会影响彼此。</p>

<h2>
<a id="user-content-分位数比例尺" class="anchor" href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#%E5%88%86%E4%BD%8D%E6%95%B0%E6%AF%94%E4%BE%8B%E5%B0%BA" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>分位数比例尺</h2>

<p>分位数比例尺映射输入域到离散的的范围。即使输入域是连续的比例尺接受任意合理的输入值，输入域指定为一组离散的值。输出范围的值的数量(基数)决定输入域中将被计算的分位数数量。为了计算分位数，输入域是排好序的，并且被当成离散值的群体(<a href="http://en.wikipedia.org/wiki/Quantile#Quantiles_of_a_population" title="http://en.wikipedia.org/wiki/Quantile#Quantiles_of_a_population">population of discrete values</a>)。输入域通常是你想要可视化的数据维度，例如股票市场每天的变化。输出范围通常是需要输出的可视化，例如一个发散的颜色尺。</p>

<p><a name="user-content-quantile" href="https://github.com/d3/d3/wiki/Quantitative-Scales#quantile">#</a> d3.scale.<b>quantile</b>()</p>

<p>构造一个新的分位数比例尺，使用空的输入域和输出范围。分位数比例尺在输入域和输出范围没有同时指定时无效。</p>

<p><a name="user-content-_quantile" href="https://github.com/d3/d3/wiki/Quantitative-Scales#_quantile">#</a> <b>quantile</b>(<i>x</i>)</p>

<p>给定输入域中的值<em>x</em>，返回输出范围中对应的值。</p>

<p><a name="user-content-quantile_invertExtent" href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#quantile_invertExtent">#</a> quantile.<b>invertExtent</b>(<i>y</i>)</p>

<p>为对应输出范围中的值<em>y</em>，返回输入域[<em>x0</em>, <em>x1</em>]的范围，代表从范围到域逆向映射。这个方法在交互时是很有用的。用来决定输入域中的值对应鼠标下的像素位置。</p>

<p><a name="user-content-quantile_domain" href="https://github.com/d3/d3/wiki/Quantitative-Scales#quantile_domain">#</a> quantile.<b>domain</b>([<i>numbers</i>])</p>

<p>如果指定了参数<em>numbers</em>，设置分位数比例尺的输入域为指定的离散数值集。数组必须是非空的，并且必须包含至少一个数值；<code>NaN</code>，<code>null</code>和<code>undefined</code>是被忽略的，不被视为样本群体的一部分。如果给定数组中的元素不是数字，将被强制转换为数字；当比例尺被调用的时候强制转换。这样，分位数比例尺可以用来强制转换所有可以转换为数字的类型。如果<em>numbers</em>参数没有指定，就返回比例尺当前的输入。</p>

<p><a name="user-content-quantile_range" href="https://github.com/d3/d3/wiki/Quantitative-Scales#quantile_range">#</a> quantile.<b>range</b>([<i>values</i>])</p>

<p>如果指定了<em>values</em>参数，就设置输出范围中的离散值。数组必须是非空的，可能包含任意类型的值。<em>values</em>数组中值得数量(基数或长度)决定了将被计算的分位数的数量。例如，为了计算分位数，values必须是一个像[0, 1, 2, 3] 的四元素的数组。如果没有指定<em>values</em>参数，返回当前的输出范围。</p>

<p><a name="user-content-quantile_quantiles" href="https://github.com/d3/d3/wiki/Quantitative-Scales#quantile_quantiles">#</a> quantile.<b>quantiles</b>()</p>

<p>返回分位数阈值。如果输出范围包含<em>n</em>个离散值，返回的阈值数组就包含<em>n</em>-1个值。值小于阈值数组的第一个元素，quantiles()[0]视为在第一个分位；更大的值第二个阈值在第二个分位，等等。在内部，阈值数组用于<a href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_bisect">d3.bisect</a>查找给定输入值对应的输出分位。</p>

<p><a name="user-content-quantile_copy" href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#quantile_copy">#</a> quantile.<b>copy</b>()</p>

<p>返回这个比例尺的一个精确的副本。比例尺的改变不影响返回的比例尺，反之亦然。</p>

<h2>
<a id="user-content-临界值比例尺" class="anchor" href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#%E4%B8%B4%E7%95%8C%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>临界值比例尺</h2>

<p>临界值比例尺很像定量 quantize比例尺，只是他允许你将输入域的任意的子集合映射到离散的输出值上。输入值是连续的，并且基于一组临界值被划到不同的区域。输入值域通常是你想要用来可视化的数据的尺度，例如是一群学生的身高。输出值域通常是所需的输出可视化数据的尺度，。例如是一组颜色(用字符串表示)。</p>

<p><a name="user-content-threshold" href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#threshold">#</a> d3.scale.<b>threshold</b>()</p>

<p>构造一组新的临界值比例尺，默认的输入范围是[.5]，默认的输出范围是[0,1]，因此，对数字来说，默认quantize比例尺将和<a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Math/round" title="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Math/round">round</a>函数相同，例如，输入0.49将输出0，输入0.51将输出1.</p>

<div class="highlight highlight-source-js"><pre><span class="pl-k">var</span> t <span class="pl-k">=</span> <span class="pl-smi">d3</span>.<span class="pl-smi">scale</span>.<span class="pl-en">threshold</span>().<span class="pl-en">domain</span>([<span class="pl-c1">0</span>, <span class="pl-c1">1</span>]).<span class="pl-en">range</span>([<span class="pl-s"><span class="pl-pds">'</span>a<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>b<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>c<span class="pl-pds">'</span></span>]); 
<span class="pl-en">t</span>(<span class="pl-k">-</span><span class="pl-c1">1</span>) <span class="pl-k">===</span> <span class="pl-s"><span class="pl-pds">'</span>a<span class="pl-pds">'</span></span>;
<span class="pl-en">t</span>(<span class="pl-c1">0</span>) <span class="pl-k">===</span> <span class="pl-s"><span class="pl-pds">'</span>b<span class="pl-pds">'</span></span>;
<span class="pl-en">t</span>(<span class="pl-c1">0.5</span>) <span class="pl-k">===</span> <span class="pl-s"><span class="pl-pds">'</span>b<span class="pl-pds">'</span></span>;
<span class="pl-en">t</span>(<span class="pl-c1">1</span>) <span class="pl-k">===</span> <span class="pl-s"><span class="pl-pds">'</span>c<span class="pl-pds">'</span></span>;
<span class="pl-en">t</span>(<span class="pl-c1">1000</span>) <span class="pl-k">===</span> <span class="pl-s"><span class="pl-pds">'</span>c<span class="pl-pds">'</span></span>;
<span class="pl-smi">t</span>.<span class="pl-en">invertExtent</span>(<span class="pl-s"><span class="pl-pds">'</span>a<span class="pl-pds">'</span></span>); <span class="pl-c"><span class="pl-c">//</span>returns [undefined, 0]</span>
<span class="pl-smi">t</span>.<span class="pl-en">invertExtent</span>(<span class="pl-s"><span class="pl-pds">'</span>b<span class="pl-pds">'</span></span>); <span class="pl-c"><span class="pl-c">//</span>returns [0, 1]</span>
<span class="pl-smi">t</span>.<span class="pl-en">invertExtent</span>(<span class="pl-s"><span class="pl-pds">'</span>c<span class="pl-pds">'</span></span>); <span class="pl-c"><span class="pl-c">//</span>returns [1, undefined]</span></pre></div>

<p><a name="user-content-_threshold" href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#_threshold">#</a> <b>threshold</b>(<i>x</i>)</p>

<p><em>x</em>代表输入域值，函数将返回对应的输出范围的值。</p>

<p><a name="user-content-threshold_invertExtent" href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#threshold_invertExtent">#</a> threshold.<b>invertExtent</b>(<i>y</i>)</p>

<p>返回输出范围<em>y</em>中值对应的输入域值的范围，代表输出值到输入值的一个反向映射，这个方法对于交互非常有用，例如可以用来定位鼠标的像素点所在的区域。</p>

<p><a name="user-content-threshold_domain" href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#threshold_domain">#</a> threshold.<b>domain</b>([<i>domain</i>])</p>

<p>如果指定了<em>domain</em>参数，那么将这个数组形式的参数作为输入域，参数数组的值必须是升序排列的，否则比例尺将是不确定的，这个参数数组的值通常是数字，但是任何自然排序的值(例如字符串)都可以，因此一个临界值比例尺适用于任何可以排序的类型。如果输出范围是N+1那么输入值范围一定是N，如果小于N的元素在输入值里，那么这个额外的元素将被忽略，如果大于N的元素在输入值里，那么对于一些输入值比例尺将返回未定义，如果输入域未定义，将返回这个比例尺当前的输入值</p>

<p><a name="user-content-threshold_range" href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#threshold_range">#</a> threshold.<b>range</b>([<i>values</i>])</p>

<p>如果存在参数<em>values</em> ，那么将这个数组形式的参数作为输出域。如果输入域是N，那么输出范围必须是N+1，如果小于N+1的元素在输出值中，那么对于任何输入比例尺将返回undefined，如果大于N+1的元素在输出值中，那么这个额外的值将被忽略，数组中的元素并不一定是数字，任何形式都可以，如果输出域<em>values</em>未定义，那么将返回比例尺当前的输出值。</p>

<p><a name="user-content-threshold_copy" href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA#threshold_copy">#</a> threshold.<b>copy</b>()</p>

<p>复制这个比例尺的精确副本。改变这个的比列尺不会影响返回值，反之亦然。</p>

<ul>
<li>补充知识</li>
</ul>

<p><img src="数值比例尺 · d3_d3 Wiki_files/687474703a2f2f696d672e626c6f672e6373646e2e6e65742f3230313630323230323330313139373138" alt="polylog" data-canonical-src="http://img.blog.csdn.net/20160220230119718"></p>

<hr>

<table>
<thead>
<tr>
<th></th>
<th>人员</th>
<th>组织</th>
<th>时间</th>
</tr>
</thead>
<tbody>
<tr>
<td>翻译</td>
<td>谭树国 ：Linear</td>
<td><a href="https://github.com/VisualCrew">VisualCrew小组</a></td>
<td>20140412</td>
</tr>
<tr>
<td></td>
<td>
<a href="https://github.com/tianxuzhang">大傻</a> ：Identity</td>
<td><a href="https://github.com/VisualCrew">VisualCrew小组</a></td>
<td>20140412</td>
</tr>
<tr>
<td></td>
<td>马语者 : Log</td>
<td><a href="https://github.com/VisualCrew">VisualCrew小组</a></td>
<td>20140412</td>
</tr>
<tr>
<td></td>
<td>
<a href="https://github.com/WeiFei365">WeiFei365</a> : Quantize</td>
<td><a href="https://github.com/VisualCrew">VisualCrew小组</a></td>
<td>20140412</td>
</tr>
<tr>
<td></td>
<td>现明涟漪 ：Threshold</td>
<td><a href="https://github.com/VisualCrew">VisualCrew小组</a></td>
<td>20140420</td>
</tr>
<tr>
<td></td>
<td>Harry ： Power</td>
<td><a href="https://github.com/VisualCrew">VisualCrew小组</a></td>
<td>20140412</td>
</tr>
<tr>
<td></td>
<td>
<a href="https://github.com/tianxuzhang">大傻</a>： Quantile Scales</td>
<td><a href="https://github.com/VisualCrew">VisualCrew小组</a></td>
<td>20141124</td>
</tr>
<tr>
<td>校对</td>
<td><a href="https://github.com/tianxuzhang">大傻</a></td>
<td><a href="https://github.com/VisualCrew">VisualCrew小组</a></td>
<td>20141124</td>
</tr>
<tr>
<td></td>
<td><a href="https://github.com/tianxuzhang">大傻</a></td>
<td><a href="https://github.com/VisualCrew">VisualCrew小组</a></td>
<td>2016-4-6 21:13:05</td>
</tr>
<tr>
<td>排版</td>
<td><a href="https://github.com/liang42hao">liang42hao</a></td>
<td><a href="https://github.com/VisualCrew">VisualCrew小组</a></td>
<td>2016-02-18 15:48:07</td>
</tr>
</tbody>
</table>

<hr>

      </div>

  </div>
  </div>
</div>
</div>


  </div>
  <div class="modal-backdrop js-touch-events"></div>
</div>


    </div>
  </div>

    </div>

        <div class="container site-footer-container">
  <div class="site-footer" role="contentinfo">
    <ul class="site-footer-links float-right">
        <li><a href="https://github.com/contact" data-ga-click="Footer, go to contact, text:contact">Contact GitHub</a></li>
      <li><a href="https://developer.github.com/" data-ga-click="Footer, go to api, text:api">API</a></li>
      <li><a href="https://training.github.com/" data-ga-click="Footer, go to training, text:training">Training</a></li>
      <li><a href="https://shop.github.com/" data-ga-click="Footer, go to shop, text:shop">Shop</a></li>
        <li><a href="https://github.com/blog" data-ga-click="Footer, go to blog, text:blog">Blog</a></li>
        <li><a href="https://github.com/about" data-ga-click="Footer, go to about, text:about">About</a></li>

    </ul>

    <a href="https://github.com/" aria-label="Homepage" class="site-footer-mark" title="GitHub">
      <svg aria-hidden="true" class="octicon octicon-mark-github" height="24" version="1.1" viewBox="0 0 16 16" width="24"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path></svg>
</a>
    <ul class="site-footer-links">
      <li>© 2017 <span title="0.21705s from github-fe127-cp1-prd.iad.github.net">GitHub</span>, Inc.</li>
        <li><a href="https://github.com/site/terms" data-ga-click="Footer, go to terms, text:terms">Terms</a></li>
        <li><a href="https://github.com/site/privacy" data-ga-click="Footer, go to privacy, text:privacy">Privacy</a></li>
        <li><a href="https://github.com/security" data-ga-click="Footer, go to security, text:security">Security</a></li>
        <li><a href="https://status.github.com/" data-ga-click="Footer, go to status, text:status">Status</a></li>
        <li><a href="https://help.github.com/" data-ga-click="Footer, go to help, text:help">Help</a></li>
    </ul>
  </div>
</div>



    

    <div id="ajax-error-message" class="ajax-error-message flash flash-error">
      <svg aria-hidden="true" class="octicon octicon-alert" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8.865 1.52c-.18-.31-.51-.5-.87-.5s-.69.19-.87.5L.275 13.5c-.18.31-.18.69 0 1 .19.31.52.5.87.5h13.7c.36 0 .69-.19.86-.5.17-.31.18-.69.01-1L8.865 1.52zM8.995 13h-2v-2h2v2zm0-3h-2V6h2v4z"></path></svg>
      <button type="button" class="flash-close js-flash-close js-ajax-error-dismiss" aria-label="Dismiss error">
        <svg aria-hidden="true" class="octicon octicon-x" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"></path></svg>
      </button>
      You can't perform that action at this time.
    </div>


      
      
      
      
      
        

      
    <div class="js-stale-session-flash stale-session-flash flash flash-warn flash-banner d-none">
      <svg aria-hidden="true" class="octicon octicon-alert" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8.865 1.52c-.18-.31-.51-.5-.87-.5s-.69.19-.87.5L.275 13.5c-.18.31-.18.69 0 1 .19.31.52.5.87.5h13.7c.36 0 .69-.19.86-.5.17-.31.18-.69.01-1L8.865 1.52zM8.995 13h-2v-2h2v2zm0-3h-2V6h2v4z"></path></svg>
      <span class="signed-in-tab-flash">You signed in with another tab or window. <a href="数值比例尺 · d3_d3 Wiki_files/数值比例尺 · d3_d3 Wiki.html">Reload</a> to refresh your session.</span>
      <span class="signed-out-tab-flash">You signed out in another tab or window. <a href="数值比例尺 · d3_d3 Wiki_files/数值比例尺 · d3_d3 Wiki.html">Reload</a> to refresh your session.</span>
    </div>
    <div class="facebox" id="facebox" style="display:none;">
  <div class="facebox-popup">
    <div class="facebox-content" role="dialog" aria-labelledby="facebox-header" aria-describedby="facebox-description">
    </div>
    <button type="button" class="facebox-close js-facebox-close" aria-label="Close modal">
      <svg aria-hidden="true" class="octicon octicon-x" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"></path></svg>
    </button>
  </div>
</div>

  


</body></html>